Tuesday, June 5, 2012

Updating Python Packages on Ubuntu/Debian

If you need to update a Python package included in an old distribution, it's pretty straightforward to do if a more recent distribution includes the version you want.

Monday, June 7, 2010

Changes in Ubuntu Lucid to udev

Each release of Ubuntu seems to bring new, backwards-incompatible changes to udev, so it was not too surprising that Ubuntu 10.04 (Lucid) introduced some problems. I had developed some reasonably complex rules to give multiple DVB TV tuners consistent device names using udev rules under Ubuntu 9.10 (Karmic), but when I applied the same rules to a clean re-install of Lucid, nothing changed.

I found that some other people also had problems (e.g. here), but I checked the man pages and everything in my rules seemed OK. Finally, I tried the following command, and everything fell into place:

sudo udevadm trigger --verbose --subsystem-match=dvb

In previous releases, the udev rules were evaluated as the computer starts. My guess is that as part of the boot-time improvements in Lucid, it now remembers the hardware configuration from one boot to the next and does not fire 'add' rules unless hardware has genuinely been added since the last boot. So, my solution is to explicitly fire the 'add' rule through the 'udevadm trigger' command to force the rules to be re-evaluated.

Saturday, May 8, 2010

HDMI Video Output with Sound

I had a few problems getting video and audio working correctly through my TV via an the HDMI from the MythTV server.

The first problem was with the video - no matter how I played with the graphics settings, a strip of the display at the top and bottom was missing from the TV picture. After some Googling, I found out this was a problem with overscan - apparently TVs can deliberately zoom into the picture provided by a video source. There is some more information here in MythTV's Overscan page. For me, the solution was simply to disable overscan using an option in the TV's menu (a Panasonic Viera HDTV).

The second problem was a distinct lack of sound through the TV. I've lost the source of this solution, but here's what I had to do:
  1. From System -> Preferences -> Sound -> Hardware, select "Internal Audio (1 output)", and then from the Profile section, select "Digital Stereo (HDMI) Output"
  2. From a console, run "alsamixer". Using the right arrow key, select "IE98 1" and then hit "m" to unmute this channel.
This second step is pretty obscure, but does the trick! Note this is for Ubuntu 9.10 (Karmic).

Monday, February 15, 2010

Booting from USB Memory Stick with Award Bios

I chose not to include an optical drive with my Shuttle SN78SH7 HTPC, thinking that I could do everything I need using a USB memory stick. I had a little bit of trouble getting the system to boot consistently from the USB memory stick. The Award Bios has a boot screen where you can choose a device to boot from by hitting F12 at startup, or a configuration screen where you set the boot order permanently. The boot options are:
  • Hard drive
  • Removable drive
  • Optical drive
I guessed that the USB memory stick would be treated as a removable drive, but it turns out that is wrong. It is actually treated as a second hard drive and there is no way of choosing this from the F12 boot menu. Instead, you have to go into the Bios configuration and re-order the hard drive priority list. Once you know this it works well enough, except that the ordering can get randomly reset if you add or remove any USB devices between boots..!

I made a few other discoveries about booting from a USB memory stick. Ubuntu provides a USB Startup Disk Creator utility, but this works only for Ubuntu distributions. There is another utility called unetbootin which supports a much wider range of distributions and has options to select an arbitrary ISO CD image for its content - however, I wasn't able to boot from the USB stick when I tried this option. I've seen suggestions that it is not possible to boot an arbitrary ISO CD image from a USB stick without having some knowledge of what's inside. Based on my experience, being able to boot from a USB stick is not a complete replacement for having a bootable optical drive.

One last thing. If you use the USB Startup Disk Creator utility there is an option for storing documents and settings in "reserved extra space" (the default option), or discarding them on shutdown. I created a bootable USB memory stick and tried it on my laptop and it worked fine. When I transferred it to my new MythTV server, it failed to boot, coming up with a number of obscure disk encryption errors. It turns out that when I booted my laptop, it wrote my-laptop-specific configuration to the USB stick which then rendered it useless on any other machine. I'd strongly recommend using the "discard files on shutdown" option..!

Saturday, February 13, 2010

Hardware for New Myth TV Server

My poor 37 " HD television still hasn't had any HD content on it. I used that as the flimsy justification to replace my PVR with a new Home Theatre PC (HTPC) Myth TV box. It's probably going to cost about three times what a decent Humax FreeSat box would cost, but I like the flexibilty of setting up my own system, and having the extras like automatic advert detection. It should also be an interesting project!

The UK doesn't currently have HD broadcasts on terrestrial TV yet, and there are limited options for HD DVB-T tuners. I decided to get one DVB-S tuner for HD on FreeSat, and a twin DVB-T tuner for general viewing/recording on FreeView. As I live in a flat with a single satellite input, it would be difficult to use multiple DVB-S tuners (you need a separate input for each satellite tuner, as it needs to switch the signal orientation that the dish receiver listens on).

Apparently Channel 4 are planning to switch to a new satellite format (DVB-S2) at some point this year. This left me with just one choice for the tuner that I could find - the PCI Hauppauge WinTV-NOVA-HD-S2. For the DVB-T twin tuner, I went for the USB PCTV Diversity Stick Solo, mosly because it was the only twin DVB-T tuner capable of receiving HD terrestrial TV when it is finally broadcast - so I thought. Actually, it was mis-advertised by DABS (it doesn't support HD), but I stuck with it anyway as otherwise it was working well. For both of these cards, I checked the support under Linux first.

For the system itself, I started looking at an AS Rock NetTop, such as the Ion 330HT-DB. With the new Nvidia ION graphics card able to handle all of the video decoding for HD, it doesn't need a high-powered processor to support MythTV. Unfortunately, it doesn't have a spare PCI slot to host the Hauppauge DVB-S card. Even if I managed to find an HD-capable USB tuner I read some articles casting doubt on whether USB 2 was fast enough to support the volume of data needed for smooth HD.

I then came across the Shuttle SN78SH7, which is what I ended up buying. This is a bare-bones system intended for an HTPC system. It is small and quiet and doesn't look out of place under my TV. The motherboard has a built-in NVIDIA GeForce 8200, which like the ION can handle the HD video decoding, and has an HDMI output for direct connection to the TV. It also has 7.1 surround sound, and is an Energy Star 4 system (power consumption is a consideration for a system that will be on all of the time). It supports the latest AMD processors - I got an AMD Phenom II 940 X4, a quad-core 3.0 GHz processor. Although I don't really need all this processing power, the cost of the Shuttle, the CPU and the memory was still a lot lower than any comparable Intel-based system.

I'm pretty happy with the Shuttle - it was straightforward to setup, and is inaudible when there is any background noise. It has a clever set of heat pipes that channel the heat from the CPU directly to the case fan, which helps cut the noise. One unfortunate aspect of this arrangement is that the AMD warranty is invalid if you use anything other than the heatsink/fan supplied with the CPU.

I had originally intended to include a Blu-Ray drive as part of the system, until I discovered that Ubuntu cannot play Blu-Ray discs directly due to the DRM included in the format. The only option open to me is to hack the disks, something I could do from my laptop and copy to the MythTV box.

For the hard disk, I chose a Western Digital Caviar Green 1 TB disk, mostly because of the energy efficiency features. It was a decision I'd come to regret (more later)...

I also got a KeySonic Super-Mini wireless keyboard with a built-in trackpad. Both the keyboard and the trackpad worked straightaway with Ubuntu, including the two-finger scrolling feature (it is a multi-touch trackpad). The quality is reasonable and it is an ideal size for an HTPC, but there are a few problems. First, the range is very limited - I get about 2 metres in my house, and that only when the USB receiver is in a front-mounted slot (although I do have a wireless network and other wireless devices that may be causing some interference). Second, the keys don't always operate smoothly, which means that you have to be quite firm when typing. As the keyboard is so small, it's difficult to touch-type without looking at the keys. Finally, some extra keys (e.g. Page Up) are activated with a function key. Unfortunately, this button is to the left of the left-control key, and I am always accidentally hitting the function key instead of the control key - very annoying for example when trying to copy/paste with Ctrl-C and Ctrl-V. This was an expensive keyboard, so given these niggles I would have some reservations recommending it.

Resolving problems with Ubuntu graphical display

I run Ubuntu 9.04 (Jaunty) on my laptop. After a session playing Enemy Territory: Quake Wars, I found the the screen resolution wasn't reset when it returned to the Gnome desktop. This hasn't happened before, but these kind of problems are usually resolved by a quick reboot, which is what I tried. Unfortunately, when it rebooted and started X, the screen was corrupt and covered in flashing squares.

I booted into recovery mode from the Grub menu, which includes an option to fix X problems - which resolved nothing. Googling uncovered the following command:
sudo dpkg-reconfigure xserver-xorg
This should have taken me through some options for resetting my graphics settings, but instead took me through options for my keyboard, which again resolved nothing.

One of the great things about the Ubuntu community is that there is never any shortage of help when things go wrong. However, one of the difficulties is filtering out obsolete advice, as there can be major differences from one release to the next. In this case, it seems that in more recent versions on Ubuntu, the graphics settings have been moved out of xserver-xorg into the driver utilities themselves. For my ATI card, the magic command to reset the graphics was:
sudo aticonfig -f --initial
(Thanks to: http://www.phoronix.com/forums/showthread.php?t=14015)

I haven't tried this, but my guess from the man pages (http://linux.die.net/man/1/nvidia-xconfig) is that the equivalent for Nvidia cards would be to:
sudo mv /etc/X11/XF86Config /etc/X11/XF86Config.old
sudo nvidia-xconfig
...which should cause it to re-initialize the X configuration. Use at your own risk..!

Friday, February 12, 2010

Welcome

Welcome to my blog! My intention is to post about various technology problems and solutions, in the hope they will be of some use to others experiencing similar issues.

I am software engineer working in Sheffield (UK), primarily with the Java and Groovy programming languages. At work I use Windows 7, and at home I have moved to Ubuntu. My focus for this blog in the near future will be my current project at home to build a Home-Theatre PC (HTPC) based on Ubuntu and MythTV. This should be a rich source of inspiration, given that I have already experiened the following problems (and still don't have it fully working):
  • My Phenom II 3 GHz x 4 processors were running at 800 MHz.
  • My Western Digital Caviar Green 1 TB disk was cripplingly slow.
  • My TV tuner cards (a mixture of terrestrial and satellite) were randomly re-ordered/re-named after each reboot.
  • My satellite tuner would not find any channels.
  • I couldn't get sound through the HDMI connection to the TV.
  • The TV picture was mis-aligned, loosing some of the picture at the top and bottom of the screen.
I will get there in the end..!