Sony Vaio VGN-SZ640 Ubuntu Maverick

04 Nov 2010 20:21

Recently I updated the Ubuntu I'm using on my laptop to version 10.10 (codename Maverick).

Although things work pretty good, I had to do some tricks to make it work in specific areas.

Broken suspend

It seems tpm* modules (who knows what they are for?) break this. Putting file like this:

# With these modules loaded suspend doesn't work
blacklist tpm
blacklist tpm_bios
blacklist tpm_tis
blacklist tpm_infineon

to /etc/modprobe.d/blacklist-tpm.conf (and rebooting) solves the problem for me.

Brightness buttons not working

Run this code in terminal:

while true; do
    line=`acpi_listen | head -n 1`;
    if echo "$line" | grep 'sony/hotkey SPIC 00000001 00000010'; then
        xbacklight -dec 25 -time 0 -steps 1
        smartdimmer -d
    fi
    if echo "$line" | grep 'sony/hotkey SPIC 00000001 00000011'; then
        xbacklight -inc 25 -time 0 -steps 1
        smartdimmer -i
    fi
done

You need to have smartdimmer and xbacklight package. The keys kind of work now (but quite lamely).

Other stuff

The Ubuntu font is great. I love it. It seems nouveaux driver (for nVidia card) is really good. It supports multi-monitor configuration via xrandr and other standard stuff. Unfortunately you won't get 3D effects (Compiz) with it and you'll need to install nVidia commercial drivers for it.

Consult Sony Vaio SZ Series And Linux for more (mostly old) information.

Comments: 0

Playing Unreal Tournament On Ubuntu Lucid

17 May 2010 07:16

I wanted to play Unreal Tournament on Ubuntu 10.04 (Lucid Lynx) 64-bit. Linux is theoretically supported by Unreal Tournament, by using custom installer. So this is how to do it:

Get Unreal Tournament

The most likely version to obtain is UT GOTY (Game Of The Year edition).

Get Installer

Go here:

http://www.liflg.org/?catid=6&gameid=51

There are two installers. Download both using BitTorrent client. For me the one witout "goty" worked.

Run installer like this:

sudo bash /path/to/unreal.tournament_436-multilanguage.run

Probably it won't run, because you don't have GTK 1.2. Bad news, GTK 1.2 isn't even available in system repository. The last Ubuntu version that shipped GTK 1.2 was Ubuntu Jaunty. My favorite trick to get packages from older distros is as follows:

sudo sed s/lucid/jaunty/g /etc/apt/sources.list -i
sudo aptitude update
sudo aptitude install -y libgtk1.2
sudo sed s/jaunty/lucid/g /etc/apt/sources.list -i
sudo aptitude update

Try to run the installer, it should work now.

Default options are generally OK, so you can keep them. Once "enter CD" dialog appears, you need to either enter the CD or mount the ISO image using the following command:

sudo mount /path/to/the/iso-file.iso /media/cdrom

Click OK, and the installer continues to run. If you're asked to enter CD2 and you don't have one, try the second installer (the one without "goty") from loki site.

Running UT

I had no luck in running UT:

quake@vaio ~ $ ut
Signal: SIGIOT [iot trap]
Aborting.

From this thread I've learned it could be solved by doing this:

cd /usr/local/games/ut/System
for i in ../Maps/*.uz ; do sudo ./ucc-bin decompress $i ; done
mv *.unr ../Maps

After doing this, you should be able, to run ut successfully.

Changing resolution

I was not able to change resolution (once I changed it, it was going back to 640x480 after a few seconds). Open file ~/.loki/ut/System/UnrealTournament.ini, locate "640" and "480" in it and change to desired resolution.

High speed

When I run UT it seemed going about 5 times faster than it should. After reading much about -cpuspeed option and playing with CPU downclocking I figured out that without sound it runs OK. After some experimenting it seems, that it's pulseaudio is causing it, once I killed it and prevented to run (it auto-respawns for some reason) UT finally worked at good speed.

sudo chmod -x /usr/bin/pulseaudio
killall pulseaudio
ut

The problem with this is that some process continuously tries to run pulseaudio, which causes CPU to be loaded and ut to run not smoothly.

So this should work:

sudo mv /usr/bin/pulseaudio /usr/bin/pulseaudio.original
echo -e '#!/bin/bash\nsleep 10000' | sudo tee /usr/bin/pulseaudio
sudo chmod +x /usr/bin/pulseaudio
killall pulseaudio
ut

Remember to do this after playing ut:

sudo mv /usr/bin/pulseaudio.original /usr/bin/pulseaudio

If you have some problems with sound after playing UT, log out and in again, and it should be OK.

NOTE: this trick should be equivalent to running pasuspender ut, but for some reason it does not work.

More tricks

When playing on LAN party we discovered more tricks:

To let UT correctly determine CPU speed, you need to set CPU frequency (using some applet or cpufrequtils) and disable additional cores (leaving one):

echo 0 | sudo tee /sys/devices/system/cpu/cpu1/online
echo 0 | sudo tee /sys/devices/system/cpu/cpu2/online
echo 0 | sudo tee /sys/devices/system/cpu/cpu3/online
echo 0 | sudo tee /sys/devices/system/cpu/cpu4/online
echo 0 | sudo tee /sys/devices/system/cpu/cpu5/online
echo 0 | sudo tee /sys/devices/system/cpu/cpu6/online
echo 0 | sudo tee /sys/devices/system/cpu/cpu7/online

(if you have 8 cores, cpu0 will be online, the rest offline).

Next trick is disabling desktop effects or window composing. For one person this meant much smoother graphics, for other it meant working sound (which is very weird, but yes, that's true).

UPDATE: Maverick Audio

It seems that on maverick the pulseaudio hack is not working, but here's what you can do instead:

  • edit /usr/local/bin/ut (may be located somewhere else, find when you installed the game)
  • find this line: ./$GAME_BINARY "$CMD_ARGS" "$@"
  • replace with: padsp ./$GAME_BINARY "$CMD_ARGS" "$@"
  • (make sure you have the padsp binary, just run try to run it)
  • then just run ut and sound works :-)

UPDATE: this works, but gives significant audio lags (200-300 ms!). This basically sucks. So the other workaround is:

  • having alsa-oss installed (program aoss)
  • having a proper .asoundrc in home directory:
ctl.!default {
  type hw
  card 0
}

pcm.dmixer  {             #this virtual device does the mixing of 
  type dmix               #the various signals
  ipc_key 1024
  slave {
    pcm "hw:0,0"
    period_time 0
    period_size 1024
    buffer_size 4096
    rate 44100
  }
  bindings {
    0 0
    1 1
  }
}

pcm.!default {             #this means that applications use the mixer
  type plug                #by default, so you can hear everything
  slave.pcm "dmixer"
}
  • having 32 bit alsa-oss libs installed (getlibs -p alsa-oss)

You need /usr/lib32/libaoss.so. Once you have it backup /usr/lib/libaoss.so and link it to the 32 bit version: /usr/lib32/libaoss.so. Then edit the ut script like before but instead of padsp use aoss. This works for me. WARNING: this overrides all ALSA applications. If you want the default configuration (that routes the audio to pulseaudio), you'll need to change .asoundrc file name after playing UT.

Comments: 4

Home Directory Snapshots

25 Oct 2009 16:12

Your home directory is where the most important data is stored.

But from time to time you just simply rm -Rf ~ and your all precious data is totally out of luck. Backups you say, don't you?

So let's think how do you do backups. cp /home/quake /my/distant/location ? On my 24 GB home directory? It would take hours. cp /home/quake /home/backups/quake/date ? Better, this will take a few minutes, but wait, I have like 120 GB of disk space, which means I can have no more than 5 backups.

What to do with this? There are two posibilities. Either you minimize data to backup to only backup important data (but figuring out what data is important may take some time and be inappropriate) or move to smarter solution, like incremental backups. Or snapshots.

Having brtfs as the filesystem for my home directory, I chose to make a snapshot of it each hour. It takes between 0 and 1 second to complete and uses almost no disk space. Why? Btrfs is copy-on-write filesystems, which means cloning a filesystems is instant as it only makes it available under two locations. And then modifying one of the two makes a real copy of the modified fragment of it and changes that copy.

OK. How to do it.

First create a btrfs filesystem (you'll need a recent kernel and btrfs-utils):

# mkfs.btrfs /dev/sda7

(sda7 is partition for my /home directory)

Then mount it somewhere else than /home, let's use /vol as an example:

# mount /dev/sda7 /vol

Create some volumes on that filesystem: home, quake, snapshots:

# btrfsctl -S home /vol
# btrfsctl -S quake /vol
# btrfsctl -S snapshots /vol

The volumes are accessible as the subdirectories of /vol:

# ls -la /vol
drwx------  1 root  root     36 1970-01-01 01:00 .
drwxr-xr-x 24 root  root   4096 2009-10-25 15:04 ..
drwx------  1 root  root     20 2009-10-25 15:51 home
drwx------  1 root  root  11488 2009-10-25 16:17 quake
drwx------  1 root  root     76 2009-10-25 15:40 snapshots

But you can mount then separately:

# mount /dev/sda7 /home -o subvolume=home
# mkdir /home/quake
# mount /dev/sda7 /home/quake -o subvolume=quake

Fix permissions:

# chown quake:quake /home/quake /vol/quake /vol/snapshots
# chmod 0755 /home/ /home/quake

Now you're ready to do snapshots. Now populate the /home/quake directory:

$ mkdir /home/quake/abcd
$ mkdir /home/quake/dddd
$ mkdir /home/quake/abcd/eeee
$ echo testtest > /home/quake/testfile

Aaaaaand, make snapshots!

$ btrfs -s /vol/snapshots/quake-`date +%Y%m%d-%H%M` /vol/quake

I figured out, that it's quite important to point to /vol/quake and not /home/quake. At first it seams that it's totally the same, but on /home/quake there can be some other filesystems mounted (like .gvfs for GNOME virtual file systems) and /vol/quake contains "pure data". When doing snapshots of /home/quake with filesystems mounted under it, the filesystems freezes for me (btrfs is still experimental, they say). So as noted above, it's better to snapshot pure data directory.

Now, the /vol/snapshots/quake-20091025-1653 (or whatever your date is) and /vol/quake should list the same files and the operation of "cloning" should be just instant no matter how much data you have. But now modifying the contents of /vol/quake should not change anything in /vol/snapshots/quake-20091025-1653 (but of course should in /home/quake).

Also the snapshot doesn't really take any disk space as long as you keep the /vol/quake directory unchanged. Once you change some file from /vol/quake, it needs to really keep two copies of it, so this is when additional space is allocated.

To sum up let's have a table listing possibilities to have the same contents in two directories:

method file copy symbolic link hard link bind-mount btrfs' clone
how cp -a dir1 dir2 ln -s dir1 dir2 ln dir1 dir2 mount -o bind dir1 dir2 btrfs-bcp dir1 dir2
time long instant instant instant instant
takes disk space yes no no no no (only the difference)
points to the same data
(changing file in dir1 changes it in dir2)
no yes yes yes no
notes not on Linux (Mac only?) btrfs-bcp not distributed in Ubuntu's btrfs-tools

More notes on btrfs and snapshotting:

  • What can be done with btrfs-bcp on directories level can be done with snapshots on volumes level (as described in this post)
  • Snapshots in btrfs are not removable yet. You can clear them and reclaim the space taken by saved difference from the starting point. Still a few bytes is taken by having the directory that is not removable. Deleting snapshots is to be implemented in stable version of btrfs.

Comments: 1

Ubuntu And Intel AGN Wireless Card

19 May 2009 15:20

I finally managed to get a version of kernel/modules that work nice on my wireless card:

06:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN [Kedron] Network Connection (rev 61)

I had problems since late Hardy or Intrepid, using different kernel from that time with no luck. The worst case was connecting to WPA2 Enterprise (user/password) secured network. In worst subcase, I had the connection for 5-20 minutes and after that the network card or driver hanged and then only computer reboot used to help.

I was used to see iwlist scan errors like "Resource temporarily unavailable" or "Busy". dmesg showed different things on different kernels.

My frustration was great, when the problem started (after some upgrades that meant to improve things) to appear even on unsecured network. The connection was broken and I had to notoriously reconnect with my NetworkManager.

Finally I found a version of kernel that plays well.

It's from jaunty-proposed repository (enable it in your Synaptic or other package manager). Don't use jaunty-backports (this one was only broken). The package that solves things is: linux-backports-modules-jaunty version 2.6.28.12.16. The install should also update the linux-image to 2.6.18-12 (update your grub.conf as usual to include the changes).

After rebooting, run uname, to verify the kernel version:

# uname -a
Linux vaio 2.6.28-12-generic #43-Ubuntu SMP Fri May 1 19:31:32 UTC 2009 x86_64 GNU/Linux

This is crucial here: 2.6.28-12-generic. The original Ubuntu kernel is 2.6.28-11 not -12.

Hope this helps someone (with VAIO SZ or any other Intel AGN-enabled notebook with Ubuntu).

Comments: 0

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License