Wednesday, 15 February 2012

11.10 Oneiric: "Bad password" and rtlwifi

Today my wireless decided to stop working (under Linux; it of course worked in Windows).

Whenever I tried to connect to a network, it (wicd, that is) would spend ages on the "authenticate" stage before eventually saying "Bad password". Of course, the password was correct. "Bad password" seems to be a generic error wicd gives you that covers all manner of actual errors.

Looking at dmesg | tail, I'd get a whole bunch of:

[  134.347782] rtl8192c: Loading firmware file rtlwifi/rtl8192cfw.bin
[  134.686790] ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  135.037001] rtl8192c: Loading firmware file rtlwifi/rtl8192cfw.bin
[  135.376045] ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  135.548216] rtl8192c: Loading firmware file rtlwifi/rtl8192cfw.bin
[  135.887744] ADDRCONF(NETDEV_UP): wlan0: link is not ready

...and so on.

lsmod | grep rtl yields:

rtl8192ce              84775  0 
rtl8192c_common        75767  1 rtl8192ce
rtlwifi               110972  1 rtl8192ce
mac80211              462046  3 rtl8192ce,rtl8192c_common,rtlwifi
cfg80211              199630  2 rtlwifi,mac80211

And lspci | grep -i network gave

04:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)

After ages of googling, I found this bug, actually a Fedora bug, that sounds a lot like mine.

Looking through the various attempts at fixes, etc, the only one that worked for me was:

ifconfig wlan0 down
iwconfig wlan0 mode monitor
ifconfig wlan0 up

I know the first line switches off my wireless for a bit, the second sets the mode to 'monitor' (whatever that means??!!), and the third switches it on again, but I have no idea what this all actually means.

It'd love to have an understanding of what was wrong and why that fixed it, but I'll definitely settle for having it fixed :).

Tuesday, 7 February 2012

Indicators in Oneiric

New annoyed-with-unity-o-meter (indicators made me feel happier):

Indicators

Today I discovered about Indicator Apps. They are just like the applets of GNOME 2 that I could add to my panel, except they're upgraded for GNOME 3 instead. They all sit up the top-left of your screen.

Also, instead of having a nice, single list of these applets where I can choose which ones to add to my panel (like in old Ubuntu), they are now....all over the place.
You basically have to look them up on the internet, add a new repository for each one, install it, and then manually run the program each time you start up to get it showing (well, I lie; you can add them into your auto-startup list to have them runn on their own).
I found this page very helpful in giving a list of the most popular indicator applets and how to install them. Then, this page gives a much bigger list of applets (although less helpful in how to install them).

Installing Indicator Applets

Since they're not in the standard ubuntu repository, you usually have to update your list of repositories that Ubuntu looks in to get packages.
Let's do an example with the Workspace indicator, which sits in your top panel and lets you switch between workspaces.
Going to its launchpad page, we see "Use this ppa for install: ppa:geod/ppa-geod".
launchpad page for inicitator-workspaces
sudo add-apt-repository ppa:geod/ppa-geod
Then, we update the list of available packages and install indicator-workspaces:
apt-get update
apt-get install indicator-workspaces
But wait! You're not done yet! Go to the dashboard and actually start the indicator. Then it will appear in your notification tray. If you right-click this one and look at the preferences you'll also see a "Start indicator at login", which you should check, if that's what you want.
Workspace switcher indicator.

List of applets I added.

  • Workspace switcher: add-apt-repository ppa:ppa/geod and apt-get install indicator-workspaces.
  • System Load Indicator - you can just apt-get install indicator-multiload this one.
  • Google Reader Indicator: lets me read my rss feeds from the panel. add-apt-repository ppa:atareao/atareao and apt-get install google-reader-indicator.
    google reader indicator (top left icon)

User menu/indicator

I don't like the "User Menu" (the little person and your username up the top left) - it only has "switch user" etc and I'm the only user on my laptop, so it just takes up space.
To remove it, go to dconf-editor and apps>indicator-session, and untick 'show-user-menu'.
Log out and back in to have it take effect (or just do unity --replace).

Current snapshot

My current snapshot is:
Left to Right: Dropbox, Google Reader, System Monitor, Workspace switcher, Messages, Battery, Volume, Date/time.

First tweaks to Oneiric Unity

These are the first things I did to Oneiric to try make it more palatable to me.

Fed-Up-With-Unity-O-Metre:

After all the tweaks so far (left is "happy", right is "argh downgrade to 10.x or use Classic Ubuntu!":

Terminal text

The terminal text is this fancy different font. I just want the normal monospace. No big deal this time --- Terminal -> Edit Profile -> General -> don't use system default font, change to Monospace size 10 (my preferred size).

Wireless icon not there/network manager not showing networks

I can't seem to get any wireless. The wireless icon I expect is not in my notification area like it used to be. When I go into System Settings > Networking > Wireless, I get no network names detected, and the 'Configure...' button is greyed out. ifconfig and iwconfig do yield the expected wlan0 interface though.

I used to have wicd installed (and apparently it still is) but I can't see the tray icon, so I go to my "Dash", type in "wicd" and open up the Wicd Network Manager (as an aside: wicd-client and wicd-gtk from the command line didn't open up any visible interface, what's its command?).

Woohoo! I can see networks and connect to them! The reason the in-built network manager wasn't doing anything is (I guess) that wicd is managing all the networks instead.

My problem was not that wireless wasn't working, but just that I can't see the wicd wireless indicator in my notification area.

So, how do I get it showing?

Following this answer, I install dconf-tools, and then run dconf-editor. I navigate to desktop>unity>panel and add Wicd to systray-whitelist. As an aside, if you want to allow any tray icon to appear, use 'all'.

Then I log out and back in. Hey presto!

Wireless slowing down startup

Another thing I noticed is that when I start up the laptop, it spends forever on the startup screen (purple-black with "Ubuntu" and the dots underneath) saying "waiting for network configuration...", followed by "waiting another 60 secondsmore for network...", ended by "starting up without network configuration". However, my wireless does work (with wicd, I don't use the standard network-manager).

Looking at this post which references this answer on this bugreport, it does appear that this is a bug, and you may get it if you upgrade (you won't get it from a fresh install) (?). The solution (the usual DANGER THERE BE DRAGONS disclaimer):

mkdir -p /run /run/lock
rm -rf /var/run /var/lock
ln -s /run /var
ln -s /run/lock /var

What these do:

  1. make directories /run and /run/lock
  2. remove directories /var/run and /var/lock
  3. create symbolic links: /var/run points to /run, and
  4. /var/lock points to /run/lock.

Argh! This didn't solve my problem. To be continued.

Argh I hate hovering over the bar to open up my application!

I do like that the side launcher hides itself when you're not using it, giving you more screen real estate. I also like the Mac-style merging of the top bit of any given window (with the min/max/restore/close buttons and the window title) is merged with the File/Edit/etc menus.

Unfortunately the side-launcher hiding means that when I want to switch between programs I can't just click on its icon and get there instantly --- I have to hover my mouse at the side of the screen to get the launcher to show, and then select my icon.

I have a few alternatives:

  • I can press the meta key (windows key for my laptop) and it will show the side bar. I'll stick with this for a while --- it's a pretty good alternative. This is enabled by default.
  • I can remove the autohide on the side bar to have it permanently show. I might do this on my big laptop, since it only takes up a small amount of horizontal space and the screen is big enough that I only worry about vertical space.

For completeness:

Disabling autohide on the side bar.

Option 1: use ccsm.

ccsm is the compiz config settings manager. You can sudo apt-get install it. (I already had it from my previous incarnation of Ubuntu).

Go to the 'Ubuntu Unity' plugin and you can set "Hide launcher" to "Never", or you could change the "Edge Reveal Timeout" to something small to get the launcher to autohide but appear instantly when your mouse goes to the edge of the screen.

Option 2:use dconf

(This is what I was initially going to do --- I discovered the compiz method by accident whilst getting my Wobbly Windows back).

You have to use dconf again! It's annoying, because you should be able to just right-click the side launcher and select "enable/disable autohide". ahh well:

dconf write /com/canonical/unity-2d/launcher/use-strut true
dconf write /com/canonical/unity-2d/launcher/hide-mode 0

Alternatively open dconf-editor, navigate to /com/canonical/unity-2d/launcher/. Change hide-mode to 0 and tick use-strut to make it True.

While you're there, have a look at the explanation for hide-mode:

Possible values: 0: never hide; the launcher is always visible. Always set /com/canonical/unity-2d/launcher/use-strut to true when using that mode. 1: auto hide; the launcher will disappear after a short time if the user is not interacting with it. 2: intellihide; the launcher will disappear if a window is placed on top of it and if the user is not interacting with it

So to go back to autohide, change hide-mode back to 2 and use-strut to false.

You have to log out and in again for this to work.

Auto-login

User Accounts > Unlock > toggle "Automatic login"

Disable lockscreen

System Settings > Screen > toggle "Lock" off

I want my wobbly windows back :(

Install/run ccsm (I already had it from my previous version of Ubuntu) and re-enable.

Customising the messenger menu

It's that little icon in the notification area that looks like an envelope:

Easily launch and receive incoming notifications from messaging applications including email, social networking, and Internet chat.

I do like having the email notifications and functionality (the "compose email" opening up thunderbird is very cool (I set thunderbird as my default mail app)), but don't want the chat/evolution bit.

Argh --- I can't work out how to get rid of the "chat" bit and leave the "email" bit --- my only option is to remove the entire menu (sudo apt-get remove indicator-messages), which I don't want to do. Oh well.

Further tweaks.

This blog post is one I just found and it has a whole list of further tweaks.

Saturday, 4 February 2012

Upgrading to Ubuntu Oneiric Ocelot 11.10 - Argh!

I finally bit the bullet and decided to upgrade from Ubuntu Natty 11.04 to Ubunto Oneiric 11.10.

I've been avoiding it for ages (my little laptop is on 10.10 and I intend to keep it there).

Ever since the Unity desktop got introduced, I don't have the courage to upgrade my Ubuntu. I really can't stand the desktop --- although it actually looks quite good! But to me it seems like an attempt to make Ubuntu look more like a Mac, and I resent Macs (another irrational move --- I think the Mac interface is amazing, and I like how it does expose *nix-like interfaces for the so-inclined. I think I just have an inherent dislike of Apple products because of the "cool"/elite aura they culture and (mostly) because of their uber-high prices).

Anyhow, I reckon that people turn to a Linux OS because they want to learn all that system nitty-gritty business, and they come to enjoy the feeling of using terminals and such because, well, it makes you feel so ... hardcore (even if it isn't ! :P). No-one thinks, "gee, I'd really like an OS with a user-friendly, idiot-proof interface --- I know, Linux!".

So I see the "prettification" of Ubuntu as a bit of a betrayal of what Linux systems are about. And that's what Kubuntu is for anyway! I know I'm being irrational and petty, but there you go.

It just annoys me that as I upgrade my version of Ubuntu, it becomes harder and harder to find the tools I need to configure, customise and tweak my system to my liking. They all get hidden away between a more and more simplistic interface in the name of "usability", and I need more and more clicks to do what I want.

My pet peeve with the new Unity desktop (with Fedora 15+ too!) is the loss of customisable panels. I really enjoyed having the top panel in which I would dump all sorts of panel applets (isn't the eyes one awesome?!). More seriously, I had shortcuts to all my most-used applications there (chrome, terminal and thunderbird).

I rely on the terminal shortcut really heavily, and it is very important to me that it is a one-click application to launch. In Ubuntu Desktop, I'm supposed to pin the terminal launcher to the side launcher, which is fine. However, to open the terminal, I first have to hover my mouse over the side of the screen to get the side launcher to appear, and then click on the terminal button. While this doesn't seem like much, it annoys me to no end that the Ubuntu dev team have, in the name of a more "usable" interface, hidden away the ability to have an always-present shortcut to commonly-used applications!

I suppose I'll find ways to tweak these niggling annoyances as I go along, but I should have been given the option to choose what behaviour I wanted, and it shouldn't be hard for me to work out how to affect these changes.

For example, I like having just two workspaces on my big laptop. By default, Ubuntu Desktop comes with 4: 2 rows, and 2 columns. I just want to change this to 1 row and 2 columns.
Easy, right? In Classic Ubuntu you just right click on the workspace switcher and you're given an option to change it. .

Not so! This time, after digging through the help files, to change the number of rows and columns of workspaces, you have to go to the terminal and use gconftool:

# set number of rows to 1
gconftool-2 --type=int --set /apps/compiz-1/general/screen0/options/vsize 1

This is exactly what I mean! I don't mind that the default workspace configuration is 2x2, but the interface is not more usable if the ability to tweak it is hidden away to some obscure command-line hack! You wouldn't know which key in gconf to edit because it isn't apparent! By all means, make the interface more usable, but make it easy to tweak as well.

Anyhow, as I learn how to tweak Unity I'll make a note of it so I can remember for if I (ever) upgrade my other laptop.

Thursday, 2 February 2012

Games todo list!

I've finally got round to compiling a list of games that I want to play; it's here.

I'm a huge fan of single-player role playing games, with uber bonus points for turn-based ones (combat and movement), bonus points for 2D graphics, and brownie points if you control a party of characters.

I guess this came about as one of my first RPGs was by the excellent Spiderweb Software company, which basically Jeff Vogel, an indie developer. My first RPG was "Exile II: Crystal Souls". Ahh, I cannot rave enough about the Exile series. They epitomise everything I want in an RPG - turn based, good storyline with fantastic humour, lovely eye-bleeding graphics. I spent many many hours playing these games and I think they're due a replay!

However, I will make concession to modern graphics every now and then, and I will play RGPs with 3D/better graphics. I won't play a game for its graphics, but I'll play it if it's good, regardless of its graphis (although if it's one of those old-style games with graphics that remind me of DOS, it doesn't have to be very good before I'll play it!)

I am also an absolute sucker for side quests. I have to complete every side quest in the game or I'm not satisfied. I'm also quite obsessive when I find a good game -- I want to play it without a break until it's done (I'm sure many of you understand...). The unfortunate consequence of these two tendencies is that there are lots of games I want to play but won't, because I'll probably lose my job and destroy all my relationships with my friends and family due to becoming a zombie intent on just finishing that last side quest. (I'm looking at you, Elder Scrolls!).

Ahh, but I can only hope.

A text-based file chooser in R

I've had to write some code allowing users to select various files for processing in R. Since they operate my script through a text console, I thought it'd be easier to provide some way for users to select the files they want processed interactively. Basically, a file dialogue in R. Furthermore, I wanted to avoid loading in any extra GUI packages (RGtk2,tcltk,...) to keep the script light-weight. Bingo! In R there's a command file.choose that allows a user to pick a file. In Windows or Mac, it comes up with a file dialog. However in Linux, it has this unhelpful interface:
> file.choose()
Enter file name: 
That's it. It doesn't offer the ability to navigate through folders, you just have to know your entire file path and enter it in. I wanted something a bit more guided. So, after asking this question at Stack Overflow, and with the help of the friendly people there, I wrote my own function to browse files:
#' Text-based interactive file selection.
#'@param root the root directory to explore
#'             (default current working directory)
#'@param multiple boolean specifying whether to allow 
#'                 multiple files to be selected
#'@return character vector of selected files.
#'@examples 
#'fileList <- my.file.browse()
my.file.browse <- function (root=getwd(), multiple=F) {
    # .. and list.files(root)
    x <- c( dirname(normalizePath(root)), list.files(root,full.names=T) )
    isdir <- file.info(x)$isdir
    obj <- sort(isdir,index.return=T,decreasing=T)
    isdir <- obj$x
    x <- x[obj$ix]
    lbls <- sprintf('%s%s',basename(x),ifelse(isdir,'/',''))
    lbls[1] <- sprintf('../ (%s)', basename(x[1]))

    files <- c()
    sel = -1
    while ( TRUE ) {
        sel <- menu(lbls,title=sprintf('Select file(s) (0 to quit) in folder %s:',root))
        if (sel == 0 )
            break
        if (isdir[sel]) {
            # directory, browse further
            files <- c(files, my.file.browse( x[sel], multiple ))
            break
        } else {
            # file, add to list
            files <- c(files,x[sel])
            if ( !multiple )
                break
            # remove selected file from choices
            lbls <- lbls[-sel]
            x <- x[-sel]
            isdir <- isdir[-sel]
        }
    }
    return(files)
}
It basically looks at the directory you specify and allows you to choose folders to explore or select. You can select multiple files too. The magic boils down to the menu, which, given a vector x, will provide a text interface asking the user to choose on element of x. Example use:
> fl <- my.file.browse('path/to/dir',multiple=T)
Select file(s) (0 to quit) in folder path/to/dir:

1: ../ (to)
2: subdir/
3: b.jpg
4: a.txt

Selection: 3
Select file(s) (0 to quit) in folder path/to/dir:

1: ../ (to)
2: subdir/
4: a.txt

Selection: 2
Select file(s) (0 to quit) in folder path/to/dir/subdir:

1: ../ (dir)
2: c.jpg

Selection: 2
Select file(s) (0 to quit) in folder path/to/dir/subdir:

1: ../ (dir)

Selection: 0
>
> fl
[1] "path/to/dir/b.jpg"
[2] "path/to/dir/c.jpg"
Nifty! (of course, it could do with improvements - allow for selecting directories say, or filter files shown).