ASRock ION 330 nettop with Ubuntu 9.04 (Jaunty Jackalope)

This is a collection of random notes about using the ASRock ION 330 nettop with Ubuntu Jaunty. This nettop is a perfect candidate for a Linux-based HTPC for me:
  • it has low power consumption (about 30 watts);
  • it is quiet;
  • its CPU is powerful (Intel Atom dual-core 1.6GHz);
  • it has a hard drive of a decent size (320 GB);
  • it can play full HD videos on Linux (with 35% CPU consumption) using the VDPAU acceleration;
  • it can drive 2 monitors at the same time (one VGA, one HDMI or DVI);
  • it is suspendable on Linux (not in every software configuration!);
  • it is wakeable on LAN;
  • almost all its hardware works out-of-the-box with Ubuntu 9.04 (Jaunty Jackalope), both i386 and amd64;
  • it works with MythTV;
  • it is cheap.

Installing Ubuntu Jaunty

Both the 32-bit (i386) and the 64-bit (amd64) desktop edition of Ubuntu Jaunty can be installed without problems either from CD or pen drive (created using UNetbootin, either a network or a normal install). The 64-bit edition is recommended, because the hardware-accelerated (VDPAU) video playback consumes much less CPU in 64-bit mode than in 32-bit mode (see below). The hard drive, the CD-ROM, the USB ports, the sound card and the LAN (ethernet) port work out-of-the box with Ubuntu Jaunty. The video controller, however, operates in compatibility mode (VESA) because Jaunty doesn't have the the proper display driver (see below for extra installation instructions), and the one shipping with Jaunty doesn't support the chipset.

Installing the nVidia display driver

Add the Medibuntu repository and the Avenard repository. Install packages with
sudo apt-get update && sudo apt-get install nvidia-glx-190 nvidia-190-libvdpau
If you don't have a Driver "nvidia" line in your /etc/X11/xorg.conf, then run sudo nvidia-xconfig to generate the proper lines. Make sure that your InputDevice in that file is not /dev/psaux; it should be Option "Device" "/dev/input/mice". Now do these as root:
# /etc/init.d/gdm stop  # kills your X session
# rmmod nvidia # may fail
# modprobe nvidia
# echo nvidia >>/etc/modules
# /etc/init.d/gdm start
Now you should have full video acceleration


Suspending works out-of-the-box in the Gnome menu for both 32-bit and 64-bit mode. Click with the mouse or press a key to resume.

To suspend remotely, issue command /etc/acpi/sleep.sh sleep in a root SSH session. (This doesn't work with the 64-bit version and the nVidia driver version 190: the system wakes up a few seconds after going to sleep. It does work with 64-bit and nVidia driver version 180. I remember it working with the 32-bit version, but I cannot remember for sure.)

To suspend so the computer can be woken up on ethernet, first run sudo ifconfig to get the MAC address of eth0, then run ethtool -s eth0 wol g; echo NMAC > /proc/acpi/wakeup as root (maybe one of these two commands is enough), then send it to sleep. To wake it up, run etherwake AA:BB:CC:DD:EE:00 (with its MAC address substituted) on another Linux machine on the local network. You may have to install the package etherwake (or something similar) for that.

Full HD video playback with mplayer

You need a recent nVidia display driver (see above) and a corresponding mplayer (from the Avenard repository). Version 190 of the nVidia display driver is recommended (from the testing Avenard repository). Version 185 may also work, but earlier versions (such as 180) don't support the ION chipset. If your package lists are set up correctly (Jaunty Universe + Jaunty Multiverse + Medibuntu + Avenard Release + Avenard Testing), apt-get install nvidia-glx-190 nvidia-190-libvdpau mplayer will install both the newest nVidia display driver and the mplayer which supports hardware-accelerated video playback. However, sometimes (e.g. on the 64-bit system for me), apt-get insists on installing and older mplayer, which would trigger the removal of nvidia-glx-190. The good mplayer package is in the Avenard repository, and it can be installed with something like this:
$ wget http://www.avenard.org/files/ubuntu-repos/testing/mplayer_1.0-svn29435-x264-vdpau-190-0ubuntu2_amd64.deb
$ sudo dpkg -i mplayer_1.0-svn29435-x264-vdpau-190-0ubuntu2_amd64.deb
$ sudo apt-get -f install
Play the video with mplayer -vo vdpau -vc ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau,ffh264vdpau, FILENAME.VID. This will consume between 30% and 40% of CPU (as measured using top) with OSD or subititles and between 8% and 9% without OSD or subtitles. Please note that the comma at the end of the -vc argument specifies that MPlayer should try other video codecs if those specified in -vc don't work for the video being played. Please note that that -vo vdpau supports non-accelerated software codecs as well, but there is a performance cost (e.g. for a non-accelerated 320x200 video file I tried -vo xv consumed 5% CPU and -vo vdpau consumed 15% CPU), but -- unfortunately -- it is not possible to make MPlayer autodetect when to use -vo xv and when to use -vo vdpau.

If you don't have a full HD video file at hand, get one from http://www.apple.com/trailers/. Use the browser's View page source functionality to get the download URL, e.g. http://movies.apple.com/movies/fox/allaboutsteve/allaboutsteve-tlrc_1080p.mov You have to insert a h in front of 1080, so the download command would be
wget http://movies.apple.com/movies/fox/allaboutsteve/allaboutsteve-tlrc_h1080p.mov
Get more information about HD video playback on Ubuntu and an nVidia ION board at http://gagravarr.livejournal.com/137571.html. If you don't want to specify the accelerated codec flags every time on the command line, you should copy them to your ~/.mplayer/config file, for example:

HDMI and S/PDIF audio output

When diagnosing sound problems, make sure that pulseaudio is not running:
sudo killall pulseaudio
Please also make sure that no other program might be using the soundcard: disable system sounds, kill all web browsers (to kill the flash player), and kill all media players.

To get default audio output on the analog stereo jack, run
$ mplayer -ao alsa $FILE
To force audio output on the analog stereo jack, run
$ mplayer -ao alsa:device=front=NVidia $FILE
To force audio output on HDMI, run
$ mplayer -ao alsa:device=hdmi=NVidia $FILE
To force output on S/PDIF, run
$ mplayer -ao alsa:device=iec958=NVidia $FILE
To list all available audio output devices, run
$ aplay -L
Please note than when specifying anything other than -ao alsa to MPlayer, you may lose DMIX support, so you won't be able to run two playbacks at the same time, and MPlayer would print:
[AO_ALSA] Unable to set hw-parameters: Device or resource busy
It is possible to fix that by using plain -ao alsa and specifying the the output device in $HOME/.asourdrc. Using the environment variable ALSA_CARD does work, but ALSA_PCM_DEVICE doesn't seem to work. Set up your $HOME/.asoundrc like this:
defaults.pcm.!card NVidia
defaults.ctl.!card NVidia
defaults.pcm.!device 0
defaults.ctl.!device 0
The device number 0 is analog output, 1 is S/PDIF and 3 is HDMI. The device numbers come from the output of aplay -l.


How to disable Skype chat notification popup boxes on the Mac OS X

This blog post explains how to disable the notification box with dark gray (black) background in the top right corner of the Mac OS X screen whenever somebody sends you a Skype chat message. The instructions given here have been verified and found working on Mac OS X 10.5.8 (Leopard), but they may not work in Snow Leopard (10.6).

One of the following solutions should work. Please try both.

  • You will not find the setting in Skype's preferences. To disable these notifications, you have to modify your Growl preferences. In the Apple menu (Apple logo in the top left corner of the screen), select System Preferences / Other / Growl / Application / Skype / Configure / Notifications. (If you don't have the item named Growl above, then that's probably because you are using Snow Leopard, and this howto cannot help you.) Here you can change the settings for various notification types. Disable Contact is typing and all containing message received.
  • (boakananda's solution) In Skype 5.0 for the Mac, the default setting is to have visual popup notifications, which are built into Skype and independent of whether Growl is installed or not. (You have the option of having Growl control the notifications, but the default is to have the notifications built-in from Skype). If you want to get rid of the notifications, go to the Skype menu, Preferences, click on the Notifications button, and select the check box Disable all visual notifications.

How to set up keys PageUp, PageDown, Home and End properly in the Mac OS/X Terminal application

This blog post explains how to set up keys PageUp, PageDown, Home and End and their shifted variants in the Mac OS/X Terminal application, so these keys work as in a Linux xterm or gnome-terminal, i.e. PageUp, PageDown, Home, End, Shift-Home, Shift-End send the corresponding escape sequence, and PageUp and PageDown navigate up and down in the scrollback buffer.

Start the Terminal, and copy-paste these commands:
S=$(defaults read com.apple.Terminal "Window Settings" | perl -0777 -pe '$X=q#
"$F729" = "\033[1;2H";
"$F72B" = "\033[1;2F";
"$F72C" = "scrollPageUp:";
"$F72D" = "scrollPageDown:";
F729 = "\033[H";
F72B = "\033[F";
F72C = "\033[5~";
F72D = "\033[6~";
#; s@(keyMapBoundKeys *= *\{.*?)\};\n@$1$X};@gs')
test "$S" && defaults write com.apple.Terminal "Window Settings" "$S"
If you don't get any error messages, exit from the Terminal application (closing the individual terminal windows is not enough) and start it again.

Alternatively, you can change the individual key bindings in Terminal / Preferences / Startup / Basic / Keyboard.

The allow non-ASCII characters (such as accented letters) in the bash command line, run
cat >>~/.inputrc <<'END'
set meta-flag On
set convert-meta Off
set output-meta On
bind -f ~/.inputrc
To make the PageUp and PageDown keys search the shell history forward and backward for a command with a prefix before the cursor, run
cat >>~/.inputrc <<'END'
"\e[5~": history-search-backward
"\e[6~": history-search-forward
bind -f ~/.inputrc


How to set up static DHCP with OpenWRT

This blog post explains how to set up the DHCP server running within OpenWRT so it always assigns the same IP address to some of the hosts.

In the LuCI web interface, select Administration, then Network / DHCP / Leases. Add your (MAC address, IP address) entries to the Static leases list. Click on Save & Apply. Ask for a new IP address at your computer. (On Debian and Ubuntu, do an ifdown eth0; ifup eth0; on Windows, do an ipconfig /renew /all, or use the Control Panel to bring the network interface down and then up again.)

Should you not get the static IP address you've set up, double check that you have specified the MAC address correctly. If you still don't get it, SSH onto the router, and run the following commands:
root@OpenWrt:~# /etc/init.d/dnsmasq stop
root@OpenWrt:~# true >/var/dhcp.leases
root@OpenWrt:~# /etc/init.d/dnsmasq start
Once this is done, ask for a new IP address at your computer.