Tuesday, August 02, 2011

Nerd Food: No sound with flash

Life on the debian testing lane is never boring. After loosing X.org for a week - its fine now, thanks! - I found myself without sound on flash. The fix was simple: /etc/asound.conf was gone, for some reason. As root, I created it again with the following content:
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}
Solution courtesy of the Ubuntu wiki.

Sunday, June 12, 2011

Nerd Food: High CPU usage with NVidia

I recently bought myself a new shiny i5 Sandy Bridge rig, and I was really looking forward to Debian Testing 64-bit and stable Intel video drivers. No more NVidia and ATI binary drivers, I shouted to the wind! However, being rather averse to reading manuals and being generally stingy, I got myself a cheap deal on a Assus P8P67 motherboard. Yep, you read right, I was blissfully unaware that the P67 chipset didn't allow access to the Intel integrated video card and what I really wanted was the H67 or the Z68. Oh well. I grinned, moaned, cursed and subsequently placed my old and trusty NVidia GeForce 7300 GS on the motherboard.

All was going well, until I started using the machine in anger. For some reason my X server started using 100% of one of the cores, rendering the whole machine unusable for _several seconds_. This was rather disappointing as I have 8 GB of RAM and a Vertex 2 SSD. This thing should fly at all times. And indeed it did fly using nouveau - except nouveau gave me really low resolution (and of course no composition).

After much, much digging I finally figured out the problem. You need to have option UseEvents set:

Option "UseEvents" "True"

Now the machine is 100% responsive 100% of the time, even under high load! However, for some reason I'm still unable to run compiz even though composition works just fine under metacity. Oh well.

Update

Sadly, my good-feeling didn't last long. Although the machine was hyper-responsive when I was using, my screen went totally black when I left the computer running overnight. Black Screen of Death you could call it. I guess this is what they meant by instability associated with UseEvents. Oh well. On the plus side, I've tried a few other options nicked from the Compiz NVidia page and things actually seem ok for the moment - knock on wood. The options are:

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "RenderAccel" "on"
Option "UseEvents" "false"
Option "RenderAccel" "True"
Option "DamageEvents" "True"
Option "TripleBuffer" "True"
Option "BackingStore" "True"
EndSection

Notice UseEvents is set to false.

Tuesday, February 22, 2011

How to access Radio Nacional de Angola from Linux

Admittedly, this may be useful to a rather limited user pool - but nevertheless. If you desperately need to access RNA (Angolan National Radio or Radio Nacional de Angola) from Linux, don't bother going to their website. You'll just get weird plug-in errors, due to the way they detect windows media support. The best way is to access the stream directly in RhythmBox. To do so, click on Library | Radio | New Internet Radio Station and add:

For Radio Luanda. Happy Listening!

Sunday, February 20, 2011

NP: Fitter Happier

Fitter, happier, more productive,
comfortable,
not drinking too much,
regular exercise at the gym
(3 days a week),
getting on better with your associate employee contemporaries,
at ease,
eating well
(no more microwave dinners and saturated fats),
a patient better driver,
a safer car
(baby smiling in back seat),
sleeping well
(no bad dreams),
no paranoia,
careful to all animals
(never washing spiders down the plughole),
keep in contact with old friends
(enjoy a drink now and then),
will frequently check credit at (moral) bank (hole in the wall),
favors for favors,
fond but not in love,
charity standing orders,
on Sundays ring road supermarket
(no killing moths or putting boiling water on the ants),
car wash
(also on Sundays),
no longer afraid of the dark or midday shadows
nothing so ridiculously teenage and desperate,
nothing so childish - at a better pace,
slower and more calculated,
no chance of escape,
now self-employed,
concerned (but powerless),
an empowered and informed member of society
(pragmatism not idealism),
will not cry in public,
less chance of illness,
tires that grip in the wet
(shot of baby strapped in back seat),
a good memory,
still cries at a good film,
still kisses with saliva,
no longer empty and frantic like a cat tied to a stick,
that's driven into frozen winter shit
(the ability to laugh at weakness),
calm,
fitter,
healthier and more productive
a pig in a cage on antibiotics.

Monday, March 22, 2010

Nerd Food: Lucid, the Lynx

Well, its that time of the year again. Unwisely, I always take the Ubuntu releases when the first betas are out, I just can't resist the urge. Not on all boxen, mind you. I always pick a victi^W candidate box to do the testing, give it a spin for a week or two and then proceed to upgrade the whole stable when I feel confident enough. It has been that way since Warty, and Lucid was no exception. However, Lucid has been exceptional in pretty much every other regard - mainly for positive reasons, but for some negative ones too. Let's retrace my steps back to the weekend, for the full Lucid experience.

In the many years I've burned ISO images I can't recall ever having had problems with dodgy media. I remember back in the RedHat 5 days when I used to religiously test the media before installing. At some point or other, having never found any defects, I gave up on that; luck has been on my side ever since. Ever since, that is, until this weekend, when the 1 GBP CD I had bought from a local camera shop - out of desperation - proved to be dodgy. After trying to install Lucid a couple of times and failing miserably with weird errors, I thought perhaps the issue was the CD. But on reboot, lo and behold: the option to test the media had been removed! I'm pretty sure it was around in Karmic, so this is a Lucid "innovation". I guess for basic users this is not that bad, but old hands will feel slightly disappointed. Back to the shops I went - this time buying six CDs for good measure. (where did I put that blasted USB key!!). This time round the installation went OK - no major innovations from Karmic, just a general sense of polish.

After installation, I was greeted with the most well thought out boot I've seen in Linux. Now, let me qualify that: I haven't used any other distro since Warty, so I don't really know what other people are up to. It is likely all distros boot this way these days - and indeed I think a lot of the glory comes from plymouth, a RedHat technology. But let me tell you the way I saw it. The boot is almost seamless; KMS, plymouth and GDM work together to provide this amazing flow from boot to usable desktop; once KMS does the mode setting there is no more dodgy flickering, blinking cursors, intro music out of sync and so many other little annoyances of the past. Its just... elegant. And the whole process takes around 40 seconds (depending how fast you can type your password, of course).

The second thing I noticed - and I'm still not quite believing myself - is the amazing, and I mean AMAZING, memory usage. I thought that there was a bug in the System Monitor applet, because the dark green colour that indicates the memory usage was so low I could not see it. This is a bit less impressive than it sounds, as this particular machine has 4 GB of RAM, so one cannot rely on percentages. But the figures reported by other tools didn't lie: less than 200 megs taken by a fully usable gnome session with no applications running. I then proceeded to install all my usual apps just to see how a reasonable session would look like. The session I'm running at the moment has the following desktop applications:
  • skype
  • empathy for messaging (facebook, MSN, google)
  • Google Chrome (8 tabs)
  • Evolution for email
  • Liferea for RSS feeds
  • Emacs for development
  • Dia for diagrams
  • Assorted PDF documents with Evince
  • OpenOffice Writer for word processing
  • Nautilus doing large file copying (restoring backups)
  • Gimp editing a couple of images
According to the System Monitor, it is costing me less than 700 megs. CPU usage is extremely low - but remember this is a 4-core system. Compared to Karmic, this is nothing short of amazing.

System Monitor Applet and Workspace Viewer with all open applications. Dark Green is used memory.

I'm still playing around with the apps, so I can't really say much about them. I have noticed a lot of crashes being reported, especially from plymouthd, tracker, etc.

Unfortunately, not everything was positive with this first experience. Having an NVidia card, the first thing I tend to do is to enable binary drivers - purely so I can use compiz. I don't really need them for anything else, but there are a couple of things that compiz provides that are so interlinked with my workflow that I struggle to function without it. In the past, NVidia drivers have worked really well, with minimal fuss. I've relied on the distro supplied ones for a while, without any problems. I regret to say, this has changed with lucid and for the worse. So much so that I know believe binary drivers are just plain harmful.

Having installed NVidia drivers I rebooted and lost X altogether. The reason why became apparent after a few hours of investigation - and it is amazing the speed at which bug reports are replied to in Ubuntu. But after applying the workaround, even though I got X back the entire smoothness experience had been lost! This is because the KMS integration is amazingly _bad_ when using binary drivers, and this is obviously not the fault of the community. It just sucks, its hard to describe. Not just that, but on my second boot, my box just HUNG! It didn't do that afterwards, but its shocking to think that with the "unstable" nouveau the experience was smooth and stable and with the binary drivers I managed to crash the box in minutes.

But NVidia wasn't done with me just yet. For the moment I need to access this box from my karmic laptop via XDMCP, a process that has been made considerably harder of late. Not a problem; nothing a xinit with a manual ssh -X cannot solve. And then I'm greeted with a totally inverted screen. And I mean totally, it was like left-to-write rotation with up-to-down or something. After much head scratching, I found out this was yet another NVidia feature. That was it, removed all traces of these nasty binary drivers and defaulted back to nouveau.

Don't take me wrong. I think its great that NVidia care about Linux and provide us with drivers. After all, they don't have to. But, from purely an egotistical perspective, I think open source, in-kernel drivers are the future. I just want something that works out of the box and is integrated into the kernel release cycle. I don't want to wait to have proper KMS support. I don't want to have to do crazy workarounds to get proper plymouth support. And I don't want weird bugs. My experiences with the Intel drivers have been absolutely positive. And now nouveau seems to be on the right track.

Anyway, those were the key problems, but there were other issues I haven't quite finished investigating:
  • pulseaudio is behaving weirdly. It seems that if I login locally and then log in remotely the sound comes out of the server's sound card - which is an acceptable behaviour for me; however, if I don't log in locally to the server, then I get no sound at all, locally or remotely. This is not so ideal.
  • Wireless is not quite working for my server network card (Broadcom BCM4318). The binary drivers are enabled and all but for some reason it fails to connect (time out). This is not too bad as the server is wired into the modem.
In addition to this, I ended up having to wire my laptop to the modem as I was finding XDMCP over wireless to be utterly unusable. The delays were akin to running a VM, seconds some times - and chrome was particularly affected by this. Using a 100-MBit cable the experience is identical to working locally. Now if only I could suspend/resume my sessions!

All and all I must say I'm really happy with Lucid, and if nouveau could do acceleration (or if I had an Intel card) I would have cried with joy on first boot.

UPDATE: One very, very important thing I forgot to mention are the silly little annoying UI changes (thanks sardaukar, your post reminded me of this!). Truth is, I ended up spending _a lot_ of time figuring out how to revert some of the new "features" such as button ordering, etc. I didn't really give them a fair trial - but my reasoning is, I'm happy with my current workflow and I can't see a need to change it. When gnome shell comes I'll re-evaluate it.

Here's a list of the things I've done til now as a script. I'll try to keep it updated.

#!/bin/bash

# do not display text next to icons on toolbars. Interface
# tab of appearance has been removed
# so you can't do this from the GUI any more.
gconftool --set /desktop/gnome/interface/toolbar_style --type string icons

# display icons in menus. they look a tad bare without them.
gconftool --set /desktop/gnome/interface/menus_have_icons --type bool true

# display icons in buttons
gconftool --set /desktop/gnome/interface/buttons_have_icons --type bool true

# fix the crazy new button placement and order.
# not sure why gconftool-2.
# (note: this is one single long line)
gconftool-2 --set /apps/metacity/general/button_layout --type=string :minimize,maximize,close

# check for updates as they come available
gconftool --set /apps/update-notifier/regular_auto_launch_interval --type int 0

Thursday, March 18, 2010

Nerd Food: Getting ls to behave

ls appears to be sorting rather weirdly of late (well, since quite a few Ubuntu releases), ignoring upper and lower case, e.g.:

drwxr-xr-x 2 marco marco 4096 2010-03-17 00:12 cmake
-rw-r--r-- 1 marco marco 8708 2010-03-17 18:39 CMakeLists.txt
drwxr-xr-x 2 marco marco 4096 2010-03-17 15:17 config
drwxr-xr-x 4 marco marco 4096 2010-03-11 18:22 cpp
drwxr-xr-x 2 marco marco 4096 2010-03-17 16:24 doc
drwxr-xr-x 2 marco marco 4096 2010-03-12 01:39 glade
drwxr-xr-x 5 marco marco 4096 2010-03-17 18:42 output
-rw-r--r-- 1 marco marco 1124 2010-03-17 16:26 README.TXT
drwxr-xr-x 2 marco marco 4096 2010-03-11 18:22 scripts
drwxr-xr-x 3 marco marco 4096 2010-03-11 18:22 sql
drwxr-xr-x 3 marco marco 4096 2010-03-11 18:22 templates

This is utterly annoying. The main reason people use upper case filenames is precisely because they come up at the top of the listing. It appears the reason why is the locale, more precisely LC_COLLATE.

$ locale | grep LC_COLLATE
LC_COLLATE="en_GB.UTF-8"

By changing it to C, it all behaves as expected:

$ export LC_COLLATE=C
$ ls
-rw-r--r-- 1 marco marco 8708 2010-03-17 18:39 CMakeLists.txt
-rw-r--r-- 1 marco marco 1124 2010-03-17 16:26 README.TXT
drwxr-xr-x 2 marco marco 4096 2010-03-17 00:12 cmake
drwxr-xr-x 2 marco marco 4096 2010-03-17 15:17 config
drwxr-xr-x 4 marco marco 4096 2010-03-11 18:22 cpp
drwxr-xr-x 2 marco marco 4096 2010-03-17 16:24 doc
drwxr-xr-x 2 marco marco 4096 2010-03-12 01:39 glade
drwxr-xr-x 5 marco marco 4096 2010-03-17 18:42 output
drwxr-xr-x 2 marco marco 4096 2010-03-11 18:22 scripts
drwxr-xr-x 3 marco marco 4096 2010-03-11 18:22 sql
drwxr-xr-x 3 marco marco 4096 2010-03-11 18:22 templates

Much better! To make it permanent, add it to your .bashrc.

Wednesday, March 17, 2010

Kids Thrive on Complexity

I've found a probability distribution that went unstudied until now, and the random process originating it is my nephew. To be more precise, its the dazzingly complex algorithm he uses to distribute the contents of a packet of crisps across a room - in his lingo: eating. Its not just the quasi-uniform floor coverage (including underneath all furniture), the fact that no two crumbs share the same size, or even its speed that makes it unique; its the efficient use of resources. A single room can be covered with _the remains_ of a small packet of crisps. Amazing.