2009-08-11

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

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:
vo=vdpau
vc=ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau,ffh264vdpau,
#vo=xv
ao=alsa
#subcp=latin2
stop-xscreensaver=1
font=Arial
subfont-text-scale=3
subfont-osd-scale=3

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.

36 comments:

jouzts said...

Does 64bit Jaunty not work?

Can you get digital audio output via the HDMI connector?

Roshan said...

Apparently it's overclockable to 2.1GHz without any problems:

http://www.tweaktown.com/reviews/2792/asrock_ion_330_bd_nettop_affordable_overclockable_and_1080p_hd/index.html

Roshan said...

According to Missing Remote.com, it does do audio-passthrough via HDMI.

pts said...

Updated the article about the 64-bit Jaunty. It works (including the live CD and accelerated full HD video playback). The advantage of 64-bit mode is that HD video playback consumes less than 10% in 64-bit mode, and more than 30% in 32-bit mode.

Chris James said...

hey i have a zotac ion board and i just wanted to thank you on the advice, it woulda taken me ages to figure out that nvidia 190 drivers even existed. thanks again.

sebi said...

thanx for this tutorial, i've testet the playback with various mkv files (1080p) to be smooth and consuming 5% to 50% cpu on my Zotac ION n230 board, which is good (the 5% was a cgi movie (bolt), and the 50% was a very noisy bond scene).

but i hate it that when i open a video file with the parameters you have posted (over "open with"), there is no gui at all, and i can't switch to fullscreen mode (at least not with the mouse).

i've tried to apply the parameters to the mplayer.conf file. if i do that, mplayer starts normally, but when im dropping a file into the gui, it stops reacting and consumes all the cpu.

do you know why it is reacting that way and how to fix that?
thanx in advance

pts said...

To sebi: Sorry, I don't know how to fix issues with the mplayer GUI, I don't use it much.

About the fullscreen mode: press f to toggle fullscreen in mplayer (or use the -fs command-line option). If you learn a few keys (or create a cheat sheet), it pays off.

herman.eggink said...

pts: excellent description which I followed in detail. Most things work as described except the suspend: it gets into suspend mode but then wakes up immediately showing the password screen. Did you do anything special to enable suspend? My feel is it may be related to the nvidia driver but the suspendlog is empty...

Nicolas said...

when i try to install the packages i get the following message:

E: Couldn't find package nvidia-glx-190

any help would be appreciated.

pts said...

If you get the error message

> E: Couldn't find package nvidia-glx-190

when installing the nvidia packages, then you have the add the Avenard repository first. See http://www.avenard.com/media/Ubuntu_Repository/Ubuntu_Repository.html for more information.

Adam said...
This comment has been removed by the author.
Tech said...

Tech Blog Link Request - www.adamsinfo.com

Hi

For leveraging traffic from the internet, I have manually collected a list of quality blogs with whom I am interested in getting associated.

I liked your blog and i'm interested in having my blog's text link in your blog roll.

Please let me know your interest in this association and then we can move towards next step.

Sincerely,

Webmaster
Adamsinfo.com
adamsinfo123@googlemail.com

Patrik said...

I had to deprecate to nVidia 185 drivers to get suspend to work (it got all the way down to nvram then auto-resumed)

No problems for you?

pts said...

Some people have reported that suspend doesn't work (the system gets autoresumed). I remember that it worked for me on 32 bit and the 190 version of nVidia drivers.

daspaf said...

Hi :) not having the same luck as everyone else.

in my xorg.conf file i read

Section "InputDevice"

# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"

I'm assuming this is the portion of the blog saying to

Make sure that your InputDevice in that file is not /dev/psaux; it should be Option "Device" "/dev/input/mice".

I try changing to...

Section "InputDevice"

# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection

...and saving but it says "you do not have the permissions necessary to save the file. please check that you typed the location correctly. any help would be awesome

PS im a newb

Stdr said...

Hi there,
I use Ubuntu 8.04 on ASRock ION 330 nettop. Monitor Samsung 24"
My problem is i cannot enable 1920x1200 resolution in this machine. It runs only 1620x1050.
I installed nVidia drivers 185.18 and 190.36 as well. But no result
Appreciate any help.

pts said...

@daspaf You have to save your your xorg.conf as root.

casbon said...

64 bit ubuntu + nvidia 180 driver works with suspend. It doesn't with 190 driver.

franco said...
This comment has been removed by the author.
franco said...

I've followed your guide but hdmi outputs no sound!

durrellpsu said...

Was there any magic to making the spdif port work? I'm able to get sound out the stereo port, but nothing out spdif. Thanks

pts said...

@durrellpsu, @franco: Updated the post with instructions for HDMI and S/PDIF audio output.

durrellpsu said...

Thanks very much!

joergbattermann said...

Thanks for the Howto!

I just tried it on 9.10 and it seems like the latest mplayer builds at http://www.avenard.org/files/ubuntu-repos/release/ are not named

mplayer_1.0-svn29501-x264-vdpau-0ubuntu2_i386.deb

anymore but rather

mplayer_1.0-svn29799-0ubuntu1_i386.deb


Using your mplayer.conf results into heavy framedrops etc so I really don't know whether accerlation is active or not... is there any way to tell?

I'm using it on a Samsung n510 (with ion, too)..


Cheers and thanks,
-J

pts said...

@joergbattermann With the acceleration active, you should see [vdpau] and the corresponding codec starting vid vdpau in mplayer's input. If you don't see *both*, then the acceleration is not active. If you are experiencing heavy framedrops, then the acceleration is not active.

oniq said...

Thank you for your post it is very helpful. Got my Asrock running Ubuntu, and could not figure out vdpau (enabled it in the preferences). Your commandline options did the trick!

GJW said...

For anyone who is interested, I've created a wiki document on installing MythTV on the ASRock ION 330 with Mythbuntu 9.10 using 3 external tuners and a USB powerswitch to save energy if the tuners are not in use:
http://asrockion.wiki.zoho.com/mythbuntu-910-asrock-ion-330.html

motumboe said...
This comment has been removed by the author.
motumboe said...

Thank you for this very detailed guide. Has anyone tested it with karmic?

Roshan said...

Karmic has native support for the NVidia v185 driver. Just enable it in "System" -> "Administration" -> "Hardware drivers", and you're good to go. I didn't have to enable any extra PPA or edit config files. After enabling the driver and rebooting, it just worked.

Installed the 64-bit version, and playing the H264 version of the video at
http://www.bigbuckbunny.org/index.php/download/ , I see ~10% CPU usage. Suspend and resume works with no problems as it's still using v185 of the stock Ubuntu NVidia driver, but it remains to be seen whether the v190 upgrade will continue to work as I saw the same auto-resume behaviour while running v190 on Jaunty.

Be sure to run "alsamixer" and ensure that all output channels are un-muted. My HDMI output channel was muted by default in Karmic.

Andy said...

Hey- thanks for this post, it helped me quickly install the latest ION drivers for my new EEE 1201N netbook with ION. The speed difference in Ubuntu (eeebuntu, 9.04) is amazing!

Taras said...

I got my system to play 1080p video yesterday (ASRock 330HT-BD) and it looks fabulous, but I did notice that when the image was panning I got shearing of sharp edges and some minor stuttering. Nothing outrageous, but it didn't seem to be CPU related. Has anyone else encountered these things?

Got tips?

runeks said...

Thanks for a very useful post. I run a 64 bit Ubuntu 9.10 (Karmic Koala) on my Asrock and playback of HD videos works fine. However, I don't get DTS through SP/DIF with the settings mentioned and need to simulate surround on my receiver. I also installed XBMC on top, and then I get full DTS sound out-of-the-box. I also have trouble playing audio CDs - both in Ubuntu and in XBMC. Any ideas?

koma said...
This comment has been removed by the author.
koma said...

Do you know how to get 5.1 surround working over HDMI ?
I got Ubuntu Karmic with boxee (www.boxee.tv, a XBMC derivate) running on top of Nvidia ION (actually, a acer revo aspire, not ASrock, but shouldn't make a difference). Sound preferences in Ubuntu report only stereo sound, and that's exactly what I'm getting. I've been reading loads of posts but no workable solution so far...
I've also seen several posts from people running Windows7 that do have surround over HDMI with nvidia ion, but I definitely dont want to go the MS way;

thx,
koen

kofo said...

@ Taras, if you have the compiz/fusion desktop effects turned on (3d cube effects etc) it can cause tearing and shearing to be very noticeable. maybe this is the problem?