Soma's Blog

May 5, 2011

Problems with Kubuntu 11.04 (and some fixes)

Filed under: Linux,Ubuntu — somanov @ 23:36

Kubuntu 11.04 has been out for a few days now and I could not resist the urge to give it a try on my Dell Latitude E6400. I have been a dedicated  Kubuntu user for many years and -with the exception of certain low points- I think the user experience has always been pretty solid. The newest release however has been somewhat ..complicated.. I ran into a few obstacles and would like to share:

Installation

I decided to install the 64bit Version of Kubuntu 11.04.  After booting into live mode and  playing around for a while I was ready to install. Alas, the installer bugged out every time I tried to run it. Turns out the installer is currently unable to install from  live mode. I had to reboot and choose the “Install now” option during boot.

Firefox + Flash

Having finally managed to install the system I went on to install some essential programs that are for some reason still missing from the default install (is there anyone out there who honestly prefers Rekonq to Firefox/Chrome ? ). Anyway Kubuntu luckily provides a foolproof installer for Firefox and the Adobe Flash Plugin (flashplugin-nonfree) can easily be installed from the package manager. Unfortunately the Flash version in the Ubuntu repo is currently a mess. Some video sites (like youtube) work fine, while others (like the Nostalgia Critic for example) are inexplicably broken. The videos flicker and stutter and are a pain to watch.  The only fix I found was to install a different version of Flash. Check out the instructions here which can easily be summarized as:  To fix Flash for Firefox 4.0.1 (64bit) do

sudo add-apt-repository ppa:sevenmachines/flash
sudo apt-get update
sudo apt-get install flashplugin64-installer

Crashes when resizing windows
Turns out installing the proprietary nvidia driver (nvidia-current) is currently a bad idea. The driver has a serious bug which causes the whole desktop to freeze / crash whenever a Konsole window is resized (in my particular case making the window smaller worked fine but making it larger predictably caused the whole computer to freeze). There is already a launchpad bugreport with a lengthy number of comments. Until this gets sorted out here are a few workarounds:

  • Use the noveau driver. The driver comes preinstalled and using it  is actually the default behavior. It works fine unless you regularly switch between 1-monitor and 2-monitor setups. In which case nvidia-settings is probably your best friend and you will want to use the nvidia driver.
  • Uninstall nvidia-current and use nvidia-173 instead. This seems to work but it comes with some slowdowns.
  • Turn off all Desktop Effects. Yes it takes away a lot of the pretty eye-candy.. but it also provides a simple, stable and fast solution for the problem.. at least until the issue with the nvidia driver gets sorted out.

Power Button – Freeze

Pressing the power button currently causes my laptop to freeze for about 20 seconds. Afterwards things start working again, but nothing else happens. Curiously, if I press the button again it suddenly works as expected and Kubuntu shows the logout menu. Again there is already a bugreport and this will hopefully be sorted out soon.

All bad?

All in all it took me quite some time to get a stable and usable version of Kubuntu 11.04. However now that everything is up and running I am pretty happy with the result. KDE4 has come a long way. There have been many big and small improvements over the last releases. Dolphin feels snappier than ever, the problems that have plagued the network manager in the past  have disappeared and I am actually starting to like Amarok again.  Yes there are still some bugs to squash and it currently takes some effort to get your install stable and usable. But these birthing pains are totally worth it. If you have not yet tried the newest version of Kubuntu. Go check it out now!

Advertisements

April 11, 2010

Flash and Gmail B0rked in Firefox 3.6.4pre

Filed under: Linux,Ubuntu — somanov @ 21:51

I updated Firefox on my netbook to Firefox 3.6.4pre today. As a result gmail stopped working and every site that uses even a tiny bit of flash completely froze my browser. Some googling revelaed that apparently the new “plugin process isolation feature” is the cause of this problem. Right now it can be fixed by going to about:config and setting


dom.ipc.plugins.enabled.libflashplayer.so = False

There. now back to watching a cat jump into a box and fall over…

March 17, 2010

Making Java work in Firefox 3.6 (Namoroka)

Filed under: Java,Ubuntu — somanov @ 15:34

About two weeks ago I carelessly installed Firefox 3.6 on my Kubuntu 9.10 System (forgot to turn off the mozilla repository before doing a full-upgrade). When I finally realized what had just happened, Firefox 3.6 was already up and running and I figured I might as well give it a try. All in all it works quite well and I have not had a lot of trouble with it.

Today I realized that java applets dont work (If I needed further prove for the fact that java has become completely irrelevant for websites this is probably it). Luckily the solution is relatively simple:

cd /usr/lib/firefox-3.6.2pre/plugins
sudo ln -s  /usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/amd64/libnpjp2.so 

Then restart Firefox and check that java is listed in about:plugins .

Now I am again able to use the ONE java applet that I am forced to use on a regular basis. Hooray!

February 14, 2010

“Two Finger Scrolling” for Ubuntu 9.10 on Dell Latitude E6400

Filed under: Ubuntu — somanov @ 22:31

Was bored today, lying on the couch with my notebook and wondering why Apple users get neat features like two finger scrolling and the linux crowd does not.

Well a few minutes of googling later I had learned that this is indeed supported by Linux but not enabled by default in Ubuntu. I had also found some very helpful sites that explain how to set it up for Ubuntu Karmic.

This blogpost talks about setting up multi-touch scrolling for the Asus Eee 1005HA netbook and the process in general. And this forum thread talks specifically about the ALPS touchpad which is built into my Dell Latitude E6400.

The main problem here appears to be that the ALPS touchpad does not support two finger recognition. However it is somehow “pressure sensitive”. Using the pressure value you can have the driver guess how many fingers you are probably using at the moment. The values output by the touchpad may vary between models, so it is best to start by debugging the touchpad output with synclient:

Reading out the touchpad values
For this Option "SHMConfig" "true" must be set in the xorg.conf .. but my xorg.conf does no longer contain a device section for the touchpad as most of the hardware is handled by HAL now. So I ended up creating a policy .fdi file for HAL which looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
<match key="info.product" string="AlpsPS/2 ALPS DualPoint TouchPad">
   <merge key="input.x11_options.VertTwoFingerScroll" type="string">1</merge>
   <merge key="input.x11_options.HorizTwoFingerScroll" type="string">1</merge>
   <merge key="input.x11_options.EmulateTwoFingerMinZ" type="string">70</merge>
</match>
<match key="input.x11_driver" string="synaptics">
    <merge key="input.x11_options.SHMConfig" type="string">True</merge>
</match>
</device>
</deviceinfo>

After restarting HAL and the xserver (or rebooting) one can start synclient with

synclient -m 10 output

Synclient will give you a lot of information about your touchpad.. Take a close look at the “f” and “z” columns. The “f” column should report the number of fingers used on the touchpad, but unforatunately it always outputs “1” on my computer. The “z” column represents the pressure value. Try operating the touchpad with one or two fingers and see how the value changes. You want to find a threshold that cleanly seperates operating with one finger from operating with two fingers. For me this threshold was about 70.

Enable 2 Finger Scrolling
Now all we have to do, is tell the driver to emulate “two finger mode” if the pressure value is over 70. This should be easy right? In a perfect world it would be. If you look closely at the above xml again, you will see that I put the corresponding lines right at the beginning of the file (and also the lines to enable two finger scrolling). My xorg.log shows that the statements are parsed correctly when the xserver starts, but for some reason they didnt have any effect in Ubuntu 9.10.

Fortunately the blogpost i mentioned before also shows a bash script to work around this problem. I had to modify some of the values in the original script. In particular the statments in the script tell the driver to emulate two finger operation when finger-pressure AND the finger-width (“w” column in the synclient output) exceed thresholds. Unfortunately my touchpad always reports a finger-width of 0, so I had to slightly adapt the script:

#!/bin/sh
#
# Use xinput --list-props "SynPS/2 Synaptics TouchPad" to extract data
#

# Set multi-touch emulation parameters
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Synaptics Two-Finger Pressure" 32 70
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Synaptics Two-Finger Width" 32 0
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Two-Finger Scrolling" 8 1
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Synaptics Two-Finger Scrolling" 8 1 1

# Disable edge scrolling
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Synaptics Edge Scrolling" 8 0 0 0 

# This will make cursor not to jump if you have two fingers on the touchpad and you list one
# (which you usually do after two-finger scrolling)
xinput set-int-prop "AlpsPS/2 ALPS DualPoint TouchPad" "Synaptics Jumpy Cursor Threshold" 32 110

Note that this script only works if the SHMConfig option I mentioned above is active. The script also disables the “edge scrolling” on the touchpad to give you a little more space.

The end result
It works, but it does not work well. I played around with various threshold values for a bit, but I could not find a combination which gave me a responsive and consistent feeling. Finally I ended up disabling the feature again. I think the main culprit here is my touchpad, which does not report enough data to distinguish one-finger from two-finger operation with the required consistency. The feature is there though, and for other touchpads it might work quite well. It may not be perfect on my notebook but nevertheless it would be nice to see this in one of the upcoming Ubuntu versions.

February 11, 2010

Fixing Eclipse for Ubuntu 9.10

Filed under: Java,Ubuntu — somanov @ 16:38

I recently discovered that Eclipse is broken beyond hope in Ubuntu 9.10. Many Buttons dont work and some other things also seem flaky at best. Apparently this has something to do with the GTK+ version used in Ubuntu 9.10. The bug is fixed in Eclipse 3.6 but previous Eclipse versions are pretty much unusable.

Fortunately I found this excellent blog post which explains the problem in detail and also gives a very simple fix for older Eclipse versions :

The solution is to create a bash script which sets an environment variable before starting eclipse:


#!/bin/sh
export GDK_NATIVE_WINDOWS=1
/home/koen/eclipse-galileo/eclipse

now everything works just fine and I can go back to coding java. Many thanks to the Blogosphere 🙂

December 27, 2009

Data Recovery with TestDisk

Filed under: Linux,Ubuntu — somanov @ 12:28

After several days of frantic picture-taking my mom yesterday managed to delete all the pictures from her digicam (instead of copying them to the computer’s hard drive). Desperation ensued. Luckily 2 minutes of googling for “file undelete on linux” turned up the name of the TestDisk utility. On Ubuntu it can easily be installed via apt.

This little gem offers a variety of functions including file undelete and can work with a great number of file-systems:

TestDisk can

  • Fix partition table, recover deleted partition
  • Recover FAT32 boot sector from its backup
  • Rebuild FAT12/FAT16/FAT32 boot sector
  • Fix FAT tables
  • Rebuild NTFS boot sector
  • Recover NTFS boot sector from its backup
  • Fix MFT using MFT mirror
  • Locate ext2/ext3 Backup SuperBlock
  • Undelete files from FAT, NTFS and ext2 filesystem
  • Copy files from deleted FAT, NTFS and ext2/ext3 partitions.

TestDisk worked flawlessly, was easy to use and made restoring all the deleted pictures (even ones deleted over half a year ago) a breeze. A big thanks to the developers and happy holidays 🙂

PS: I just browsed around the TestDisk site and found a second tool called PhotoRec . This is a specialized tool for recovering video and photo files. In contrast to TestDisk this utility ignores the file system and goes after the underlying data, so it will still work even if your media’s file system has been severely damaged or reformatted. Luckily I did not need it to recover my photos but if using TestDisk fails, this tool might be worth a try.

December 11, 2009

Ubuntu 8.04 on KVM weirdness

Filed under: KVM,Linux,Ubuntu — somanov @ 17:23

I have been using KVM on my Ubuntu Karmic installation for some time now. I have a Windows guest which I start from time to time to perform some tedious tasks which require Microsoft products. So far KVM has worked flawlessly for me and I have come to prefer it to other solutions like VMWare.

Today I needed a 64bit Ubuntu 8.04 system to test something. Installing an Ubuntu 8.04_amd64 server guest in KVM was a matter of 10 minutes. The installation went smoothly and everything looked well but after rebooting the new system the guest would hang at the Kernel message “Loading Hardware Drivers”. I tried booting serveral times. I tried booting into recovery mode. The KVM process and virt-manager locked up every time and I needed to kill -9 them. I did a few quick searches on google but could not come up with anything.

Frustrated I started to remove virtual hardware from the guest system. After removing the Serial Interface and the Sound Card the guest would suddenly boot without any sign of trouble.

I am still not sure which of the two pieces of hardware caused the problem. Perhaps I will try to reproduce the error later and file a bug when I find the time . For now I am just happy this works..

December 2, 2009

Window Shortcuts for Linux

Filed under: Linux,Python,Ubuntu — somanov @ 22:14

One thing that has bugged me for a long time ( no matter on what operating system) is the overhead for task-switching.

On my typical desktop there are a lot of open applications (these include Eclipse/KDevelop, some simple Text Editor like Kate or PSPad, Firefox, SSH sessions in consoles, QGis, a chat client etc.) and I typically do a lot of switching between them.

Naturally there are various ways for task-switching built into the Desktop.  These include the taskbar, the ALT-TAB shortcut or the (admitteldy great-looking) Expose Feature (“Present Windows”) many of the newer Linux Desktops are offering. But I find all of these methods counter-intuitive because they require me to visually search for the window and recognize it by its name or appearance.  The situation gets even worse when you have several instances of the same program -probably spread over multiple Desktops- and you need to find the correct one (as it is often the case with file-managers for example).

Long story short: I find the process of visual task-switching unecessarily complicated and overall disruptive for my concentration.

At this point I have to confess that I am a sucker for keyboard shortcuts. Sure they require a little extra effort to memorize, but once that is done they are real time-savers.

A task switching behavior that much better fits my way of thinking would look like this: Assign a Keyboard shortcuts to the most used applications. (eg.: WIN+f–>firefox) If this shortcut is pressed…

  • ..and no instance of firefox is currently running then start a new one
  • .. and a firefox instance is running then switch to it (no matter on which desktop it might currently be hiding)
  • .. and several instances of firefox are running then cylcle through them (pressing the shortcut repeatedly)

I am aware of the different Window Shortcut features that are built in various Linux desktops, but as far as I could find out none of them fit all the above requirements. After a lot of googling I stumbled upon this gem which nearly perfectly does what I want, except for the “cycling through windows” feature. To customize it to my exact needs I decided to do a rewrite of the script in Python. The result works beautifully for my needs on recent Ubuntu versions.

The script makes use of the wmctrl utility which can easily be installed with

sudo aptitude install wmctrl

Here is the “focus” script:

#!/usr/bin/env python
import os
import sys
import commands

program_name = sys.argv[1] # the program to be focused

# get all windows which contain "program_name" from wmcontrol
candidates = sorted([x.strip() for x in commands.getoutput(""" wmctrl -l -x | awk -v win="%s" 'tolower($0) ~ win {print $1;}' """ % (program_name, )).split("\n") if x !=''])

if candidates : # at least one candidate found , we need to check if the active window is among the candidates (for cycling)

        # Get the id of the active window

        # Note: wmctrl currently does not support getting information about the active window.  In order to realize this
        #       we use xprop here. Unfortunately xprop gives us the window id of the active window in a different format:
        #       Window ids from wmctrl always begin with 0x followed by 8 digits (leading zeroes for padding). xprop
        #       does not do the padding and might give a window id starting with 0x followed by only 6 digits. The
        #       lines below get the id of the current window and make the id returned by xprop comaptible with
        #       the window ids returned by wmctrl.
        active_window_string = commands.getoutput("""xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" """)
        active_window_string =  active_window_string[active_window_string.find("#")+4:].strip()
        active_window = "0x" + "0" * (8-len(active_window_string)) + active_window_string

        next_window = None # the window to display. (one of the windows in candidates)
        if active_window not in candidates: # if the active window is not among the candidate windows
                next_window = candidates[0] # ..just show the first candidate window
        else:# we are already showing one of the candidate windows
                next_window = candidates[ (candidates.index(active_window)+1) % len(candidates)] # show the *next* candidate in the list (cycling)

        if next_window:
                os.system(""" wmctrl -i -a "%s" """ % (next_window,) ) # tell wmcontrol to display the next_window
else : # no windows open which fit the pattern of program_name
    os.system("%s &" % (program_name,)) # open new window

You can put it in your PATH and then use xbindkeys (or some other keyboard shortcut utility of your choice) to create mappings like

WIN+f –> focus firefox

I have defined shortcuts for my 5 most used applications, and have been using them for about half a year now. I feel this has really helped me to streamline my interaction with the UI.

Create a free website or blog at WordPress.com.