Troubleshooting

Remove X Cursor in XBMC

I’ve found a few annoying issues while configuring my HTPC with XBMC – one being the X cursor re-appearing after long idle states.  The cursor will go away after restarting XBMC, but this is annoying to do several times a day.  The fix is quite simple – the steps are listed below.

sudo nano /etc/X11/xorg.conf

In the text editor – find the section of the file labeled Section “Device”.  The ending of this section is simply EndSection.  Add the following line before the EndSection statement:

Option    "HWCursor" "false"

Simply restart X either by restarting XBMC or the machine completely.  The cursor should now stay gone for good!

XBMC HDMI Audio Troubleshooting

I ran into some issues while configuring my XBMC HTPC with HDMI audio.  After some time with various troubleshooting steps I was able to repair the issue by completing the following steps:

 

Relevant system specific information:

OS: Ubuntu Desktop 11.04
HDMI Device: XFX ATI 5770

sudo alsamixer

Ensure no devices are muted (indicated by “MM”).

sudo alsactl store 0

This step saves the running alsa configuration

sudo aplay -l

This command will list the installed alsa devices.  Choose the device which you want to output the HDMI audio from – paying attention to the card number and device number.

card 1: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]

The above information is used to configure a custom audio device within XBMC.  Within the XBMC system configuration settings, change the output device and output passthrough device to custom with the following name:

plughw:1,3  (Note that yours may differ – it is based on the output of the aplay command.

 

After saving, restarting the machine, and re-launching XBMC, I was now receiving audio over HDMI – though sounds for the system menus no longer functioned (an issue I’ve since ignored).  However, when I played audio, it did not seem as though I was receiving the center channel audio.  I was able to fix this by an odd combination of configuration settings.  While playing a video I set the audio to analog – changed the volume from -60db to 0db, and switched audio back to HDMI.

Ubuntu Server PXE Install

I was working on a set of Ubuntu servers for a cluster in my network lab and wanted to look into alternative boot methods to streamline the process.  I followed a lot of tutorials which recommended setting up a new DHCP server that could assign the machines leases and then direct the machines to the correct boot file.  After some failed attempts with running a temporary DHCP and TFTP server on a Windows machine I sifted through my DHCP server settings for pfSense and found that it actually had support for network boot built in.  This was great and allowed me to skip the whole DHCP server step and just change the following in the Services > DHCP Server tab in pfSense:

Of course for this to work I had to have pfSense’s DHCP server enabled.  Having this setup will now allow the bootable machines to be assigned a DHCP lease then look for the TFTP server at the address specified (192.168.2.200 in my situation) and to look for pxelinux.0 to boot from.  The next portion of this setup is a slightly modified version of the article found here https://help.ubuntu.com/community/PXEInstallServer , modified in the sense that I left out any DHCP server steps due to the fact that I’m handling the direction through pfSense.

Setting up your PXE server on Ubuntu:

sudo apt-get install inetutils-inetd tftpd-hpa

sudo nano /etc/default/tftpd-hpa

Make sure this file looks like this:

#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"

Save the file if you need to make any changes and restart the daemon:

sudo /etc/init.d/tftpd-hpa restart

sudo nano /etc/inetd.conf

Edit the file so it looks similar to the following (note that you may need to change “udp” to “udp4” to override the default and use IPv4:

tftp    dgram   udp    wait    root    /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

Once completed editing this file we need to copy the boot files from the Ubuntu ISO or CD.  In my case I inserted the Ubuntu Server CD into the machine’s drive and then completed the following:

sudo cp -r /media/cdrom/install/netboot/* /var/lib/tftpboot/

You can copy these files from wherever you’d like just as long as they end up in /var/lib/tftpboot/

At this point you should have everything in working order on the server side.  If your NIC has a boot menu for network boot (as some of my Intel NICs do) you can go ahead and try booting to the network.  If successful, it should retrieve the file from the server and then proceed to the Ubuntu Server installation screen.  If you want to customize your boot from this point (for example, retrieving the files from a local CD instead of over the Ubuntu mirrors via HTTP) see the Ubuntu guide listed earlier.

Client Machine Setup Using gpxe:

I found that I had better results using gpxe on the client machines.  I setup a boot floppy that included all of the NIC drivers by going to this website http://rom-o-matic.net/gpxe/gpxe-git/gpxe.git/contrib/rom-o-matic/ and choosing “all-drivers” and selecting a .dsk as the output format.  There are many different options you can chose as well if you would rather use USB or CD for example.  I created a floppy from this image using the following command:

dd if=IMAGE.dsk of=/dev/fd0

The example above assumes IMAGE.dsk is in the directory you issue this command from and also that your floppy drive is located at /dev/fd0.

This boot disk is quite useful if you are running into any issues.  It has a menu with a few setup and diagnostic commands.  You can manually set the server of which to direct once booted to this disk (if things don’t work for you automatically), change the target boot file, etc.

Troubleshooting:

Hopefully this gets those interested in PXE boot going successfully.  If you are having any problems, here are a few things to check:

  • Check your DHCP server settings.  Ensure that the IP address and filename is correct.
  • Check all of the configuration files edited earlier in this guide.  Any typos in the directory path will prevent things from working properly.
  • Check that your PXE server is listening by issuing the following command:
    netstat -a | grep tftp
  • Check that your NIC supports PXE boot
  • Check that you have properly enabled network boot in BIOS

If I’ve missed anything feel free to contact me and I’ll add any additional steps for setup or troubleshooting to the list.

WordPress 3.0 Upgrade Error Fix

I was recently upgrading the version of WordPress on one of the sites I run and encountered the following error: “Fatal error:

Call to a member function on a non-object in  *SITEHERE*/taxonomy.php  on line 289".

It took me a little looking around to find a solution but there was someone nice enough to look into it in the wordpress forums and posted a solution.  Hopefully this article can save those of you with a similar issue some time in getting things running again.

The problem occurs due to an error in the “Podcasting Plugin by TSG”.  The fix is actually pretty simple and requires a few quick steps:

1. Manually deactivate all plugins.  The procedure to do so when you can’t access the administration menu is located here.

2. Edit the file SITEROOT/plugins/podcasting/podcasting.php – On line 15 replace the code:

register_taxonomy('podcast_format', 'custom_field');

to

function build_taxonomies() {
register_taxonomy('podcast_format', 'custom_field');
}
add_action( 'init', 'build_taxonomies', 0 );

3. Re-enable your plugins and test your site – if this was the issue, things should be working properly now.

4. Upgrade the Podcast plugin in the Plugins menu.  I upgraded to Version 2.3.10.

Thanks to wordpress forum user ddarby14 for posting the solution.  Source thread.

I checked out this plugin and the offending line I found was line 15 in /plugins/podcasting/podcasting.php

register_taxonomy('podcast_format', 'custom_field');

I changed this to a function call

function build_taxonomies() {
	register_taxonomy('podcast_format', 'custom_field');
  }
  add_action( 'init', 'build_taxonomies', 0 );

Boot To USB Without BIOS USB Boot Support

On any new machine I purchase I ensure to thoroughly run all hardware with the various diagnostic applications available on the Ultimate Boot CD.  I have the UBCD setup on a USB drive which allows me to ditch the CD wallet.  Problem is, even in this day and age, there are still machines I encounter that are not compatible with USB boot.  Most of the time I’ll burn an ISO to CD and hook up a spare CD-ROM drive, but recently I was determined to get the computer to boot to USB.  No BIOS update was available and I searched every inch of the BIOS menus looking for a USB boot option with no success.  So, after some browsing around I found PLoP.  PLoP is a Boot Manager that will (among other things) allow a machine to boot to USB even without BIOS support.  It’s actually quite an easy solution but does require you to make either a floppy or CD.  Since the machines I was working with were previously used in a cluster they had no CD-ROM drives but they did contain a floppy drive.  To create a PLoP boot disk using another Ubuntu machine I completed the following:

wget http://download.plop.at/files/bootmngr/plpbt-5.0.10.zip

sudo apt-get install unzip

unzip plpbt-5.0.1.0.zip

cd phpbt-5.0.10/

Insert the floppy to write to into the drive.  I’m assuming it’s located at /dev/fd0.

fdformat /dev/fd0

dd if=plpbt.img of=/dev/fd0 bs=1440k

Once you complete this you have created the bootable floppy and can now boot the machine to the floppy which contains the boot manager.  You will need to ensure that the installed floppy drive is listed on the boot list.  Note that the ISO is also included in the downloaded package if you would rather create a CD.

After you boot into PLoP there is a list of available boot options.  USB should be an option in the list and you simply select that as the boot option, press Enter, and your USB bootable drive can now be accessed!  Note:  Once booted to USB I could *only* use PS/2 keyboard and mouse with the machine.

Reassign NIC Identifiers In Ubuntu

I swapped out some NICs recently on a few of my lab machines.  These machines had a working install of Ubuntu Server 9.04.  After installing the NICs and rebooting, ifconfig showed nothing but lo details.  The first thing I did was ensured that the cards were seen by the OS by typing:

lspci | grep Ethernet

to which I received the output:

02:04.0 Ethernet controller: Intel Corporation 82557/8/9/0/1 Ethernet Pro 100 (rev 08) 

02:05.0 Ethernet controller: Intel Corporation 82557/8/9/0/1 Ethernet Pro 100 (rev 08)

This was correct as my new NIC was a dual Intel NIC.  From there I issued the command:

sudo mv /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.old

I reboot the system and all NICs were re-assigned to the correct Eth* interface.  Note that that the 70-persistent-net.rules.old will contain the old configuration should I choose this new NIC doesn’t work out for the system.

Where I originally found the re-assignment command.

HP Laserjet P1006 CUPS Fix

Frustrating issue today with a fairly common printer I purchased for school use. An HP Laserjet P1006. CUPS seemed like the logical solution for network printing. Set the printer up in the guided setup (System > Administration > Printing) in Ubuntu 8.04. It detected it immediately and then found a driver for it. All seemed well but when I hit the “Print test page” option nothing happened. The print job stated that it was completed around a minute later. No errors were found in CUPS logs. After some searching I found a tutorial to manually install the correct driver (http://foo2xqx.rkkda.com/). The problem with this is that you have to remove the printer entry you created previously before continuing with this step-by-step tutorial. I tried just deleting the printer I had added, but it didn’t work. I started fresh and removed CUPS, then re-installed:

sudo apt-get remove cupsys cupsys-client

sudo apt-get install cupsys cupsys-client

I also removed the printer configuration:

sudo rm /etc/cups/printers.conf

sudo rm /etc/cups/printer.conf.O

This may have been overkill and I had no previous printers configured, so you may not need to (or want to) remove those files.

After those removal steps I continued with the tutorial once again foo2xqx.rkkda.com and all worked correctly. I chose the option NOT suggested by Ubuntu when drivers were being chosen. Test print was successful. Quite frustrating that such a common printer is having issues with CUPS. Hopefully this can save someone else the trouble I went through figuring this out.

EDIT:

Thought I would add the step-by-step directions when completing this through terminal (with gnome not installed).

Since the localhost has no GUI, the easiest way to add the printer is through the web GUI remotely from another machine.  To successfully do this you need to allow permissions to the remote machine (by default CUPS will only listen for connection from the localhost.)

sudo nano /etc/cups/cupsd.conf

Find the line starting with “Listen” and change it to “Listen 0.0.0.0:631″ .

You also need to allow access to the web configuration.  Because this was for a temporary setup I just added “Allow @LOCAL” within all of the restriction fields.  Note that this is just a quick fix, and priveleges were removed soon after.  Setting to allow local for everything permanently would be a *very* bad idea.

After changing permissions accordingly, restart cupsd

sudo /etc/init.d/cups restart

The following are the instructions per foo2xqx.rkkda.com for the P1006:

wget -O foo2zjs.tar.gz http://foo2zjs.rkkda.com/foo2zjs.tar.gz

tar zxf foo2zjs.tar.gz

cd foo2zjs

./getweb P1006

sudo make install

sudo make install-hotplug

Now Unplug and re-plug the USB printer.

sudo make cups

If all went well you can now login to the cups GUI using the url (substituting cupshostip with the IP of your CUPS host):

http://cupshostip:631

If you get permission denied errors you have not edited the permissions properly in the cupsd.conf file.  If you are not able to connect at all double that the “Listen” line was edited properly.

Once you are in the CUPS web GUI adding the printer is fairly straight forward.  Just click “Administration” tab at the top, then click on “Find New Printers”.  This should detect your P1006.  The correct driver should be selected by default here: “HP LaserJet P1006 Foomatic/foo2xqx (recommended)”.  Now you can add the printer and all should work correctly.  Don’t forget to remove the permissions added in cupsd.conf to a more secure permanent setup.

Testing Network Performance Using Iperf

Just a quick post on a great tool for testing network performance. Iperf is a very slim tool that will measure TCP/UDP bandwidth performance. It is an available ubuntu package “iperf ” and also has Windows/OSX binaries available. I found a working mirror here. What makes Iperf a good test versus a simple SMB/CIFS transfer for bandwidth performance is that it works in memory versus being limited by hard drive and CPU limitations.

Now a quick guide to get things up and running. The guide will be for two Ubuntu machines, testing network performance between the two.

1.Install – Type the following in terminal “sudo apt-get install iperf ” for both machines

2.Server Setup – Decide upon a server machine and a client. On the server type the following in terminal “iperf -s ”. This will place iperf in server mode, and it will listen for incoming connections.

iperf server

3.Client Setup - On the client machine you have a lot of options to play around with regarding how you want to connect to the server. You can explore what each of these are by typing “iperf –-help ”. The following is a simple test between the server (192.168.2.104), and the client (192.168.2.103).

4.Testing - Type “iperf 192.168.2.104 -i 2” (replacing the IP here with the test server IP and then enter key to start testing. This will connect to the server running on 192.168.2.104 and have an interval of 2 seconds. There will then be 6 tests completed. This should give you all of the information you need regarding your connection speed between the two machines.

iperf client

This should be enough to get you started using iperf. Check out the man page here if you have any usage questions.