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!

Advertisement

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…

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 4, 2009

Unslung Adventures

Filed under: Linux,Tech — somanov @ 23:16

I recently bought a Linksys NSLU2 Network Storage Link from Amazon :

The Linksys NSLU2

Basically this little guy connects two normal USB drives to your network exposing them as samba shares…or at least thats the purpose the manufacturer intended for it. But with the right firmware it can do a lot more..

After playing around with the stock firmware for a while I decided to try one of the replacement firmwares from http://www.nslu2-linux.org/ . There are several projects which offer custom (Linux-based) firmwares for users with different Linux expertise. There is a Firmware Matrix which shows what the different versions can do.

I mainly wanted to expose my USB drives to my home network (and maybe have a neat toy to play around), so I decided to go with the Unslung 6.10-beta firmware, which is basically an improved and open version of the stock firmware. It offers a nice web interface, has a lot of custom built packages and is targetted at users with little Linux knowledge.

All in all flashing the new firmware and configuring the device went pretty well. I followed the steps in the excellent Readme. However I ran into a few gotchas while configuring the device, some of which I did not find too clearly documented in the wiki. I thought it might help to post my findings. So here they are (in no particular order):

Stay away from NTFS
Actually this one is clearly stated in the FAQ but I thought it might be a good idea to emphasize it. Unslung -like the stock firmware- is based on a 2.4 Linux Kernel. It uses a very old and buggy NTFS driver, which did not play very well with my 1TB NTFS drive. Directories with a lot of files in them were empty or would not be displayed at all. Also it appears the driver may cause the whole system to hang under high IO load. Other firmwares like OpenSlug are based on a more recent 2.6 Kernel, and _might_ not have these problems (I guess the ntfs-3g module should be available there, but I did not check). Anyaway I decided to stay with Unslung and to reformat my drive to ext3. Which brings me to my next point:

Be careful with EXT3
In principle Unslung supports the ext3 filesystem, but it is very picky about its parameters. In particular it is unable to handle ext3 filesystems with an Inode size of 256 (this setting is standard when creating the filesystem from a modern Linux distribution). I had to use the following command to create an ext3 filesystem that would work in Unslung:

mkfs.ext2 -j -I 128 -m 1 /dev/sdb1

If you have an existing ext3 disk and want to know if the Inode size is compatible use:

sudo tune2fs -l /dev/sdb1 | grep Inode

An other related point:

The WebGUI’s “format” option does not create a simple ext3 filesystem
(although it might appear to be the case). If you format a drive in the web-gui you get a natively formatted disk. It has an ext3 partition for your data but contains additional partitions which are used by Unslung to store config files etc. This distinction is very important as you might be running into a lot of trouble with two natively formatted devices (see Rule 1 + the exceptions to Rule 1 ). In order to make the most of your device you need one natively formatted device (which contains the “unslung” root filesystem), but it is safer if you do not have two. But its no problem to have your other disk formatted as ext3, as long as you did not format it in the web-gui. Do it on a normal linux-box and use the command I mentioned above.

Your ext3 drive will not auto-mount
I dont know if thats a general rule, or just my stupidity, but I could not get the ext3 drive to auto-mount. The device would be recognized but I could not get Unslung to automatically mount it and create a samba share for it. The details of manually achieving this are worth mentioning because they were quite surprsing for me:

  • Dont use /etc/fstab ! It is overwritten at boot (dont know why). Also it does not understand the “auto” option which would be needed to automatically mount the device anyway. Instead I added the required mount command to /etc/rc.d/rc.local For a somewhat cleaner solution have a look at diversion scripts
  • Manually add the samba share to /etc/samba/user_smb.conf . My entry looks like this:
    [NAS]
    valid users=@"administrators",@"everyone"
    comment=For everyone
    path=/mnt/usb_maxtor/nas/
    read only=no
    write list=@"administrators",@"everyone"
    

Transmission
Transmission is a Bittorrent client which can be installed with the “ipkg install” command. It provides a nice web interface for managing your torrents and works pretty well. When I first started the transmission-daemon and tried to connect to the web interface, I got an error message telling me that access from my IP was not allowed and that I should add it to some config file to fix this….but alas I could not find the file -it had not been created. The fix for this was to run

transmission-daemon -a <my_ip>   # adds  my_ip to the list of allowed addresses

this allowed me to access the web interface, and also created the config file that was missing before.

Ok thats all I can think of for now. Maybe I’ll post an update to this if I find any more things worth mentioning 🙂

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.