Skip to content

Linux Daily

Daily usage of linux, raw style

Category Archives: Uncategorized

So it seems I finally got my filthy hands on a Raspberry Pi. So far so good, although the software stack is a bit lacking still. I’m sure it will catch up. Anyway, I immediately loaded the debian distro to an sd card, which, for the record, consists in doing

dd bs=1m if=~/Downloads/debian6-19-04-2012/debian6-19-04-2012.img of=/dev/rdisk1

and I was good to go.  The next essential step was to setup a decent remote ssh session. This is pretty trivial stuff, the only reason I’m posting this is I found a very simple way to give the Raspberry Pi access to the internet, while accessing it through ssh. Sounds interesting? Let’s bring it!

1. Set up ssh on the PI

It’s a matter of starting it

sudo service ssh start

and adding it to the list of startup services

sudo insserv ssh

2. Configure main machine

In network manager, just configure a wired connection like so

and so

It goes without saying that at this point you should restart the Raspberry Pi or its networking system. Right? Right?? I mean JESUS CHRIST this is some pretty basic SHIT I mean WHATLKDASlkNSDf THIS IS WHAT HAPPENS WHEN YOU FUCK A STRANGER IN THE A- –

3. Grab Pi’s IP

At some point your main machine is going to attribute an IP to the Pi. You can monitor syslog like so

tail -f /var/log/syslog | grep dnsmasq

For the record, it should look something like this

May 19 18:57:05 ubuntu NetworkManager[891]: <info> Starting dnsmasq...
May 19 18:57:05 ubuntu dnsmasq[5763]: started, version 2.59 cachesize 150
May 19 18:57:05 ubuntu dnsmasq[5763]: compile time options: IPv6 GNU-getopt DBus i18n DHCP TFTP conntrack IDN
May 19 18:57:05 ubuntu dnsmasq-dhcp[5763]: DHCP, IP range --, lease time 1h
May 19 18:57:05 ubuntu dnsmasq[5763]: reading /etc/resolv.conf
May 19 18:57:05 ubuntu dnsmasq[5763]: using nameserver
May 19 18:57:05 ubuntu dnsmasq[5763]: cleared cache
May 19 18:57:52 ubuntu dnsmasq-dhcp[5763]: DHCPDISCOVER(eth0) b8:27:eb:84:ea:79
May 19 18:57:52 ubuntu dnsmasq-dhcp[5763]: DHCPOFFER(eth0) b8:27:eb:84:ea:79
May 19 18:57:52 ubuntu dnsmasq-dhcp[5763]: DHCPREQUEST(eth0) b8:27:eb:84:ea:79
May 19 18:57:52 ubuntu dnsmasq-dhcp[5763]: DHCPACK(eth0) b8:27:eb:84:ea:79

Usually the IP attributed to the Pi is always

4. Connect

You can go old school

ssh pi@

Or with X support for GUI applications

ssh -X pi@

Remembering that the default username is pi with password raspberry.

All done!


If you want to go for a static ip solution, you need to edit the proper config file

nano /etc/network/interfaces
so that is looks like
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo
iface lo inet loopback
# iface eth0 inet dhcp
auto eth0
iface eth0 inet static

I use keyboard shortcuts in Firefox a lot. Ctrl+t for new tab. Ctrl+l to enter an address. Ctr+k for the quick search box. F11 for fullscreen.

I noticed that none of these work when I was watching a video on youtube. Which sucked. A lot. Turns out that’s bug 78414 in bugzilla, and it was reported back when I was in primary school and thought girls were gross. But things have come a long way, indeed there is a $1000 dollar “bounty” on the thing and still nothing has happened. brilliant.

See what I did there?

The other day I was a bit pissed off because network manager would not show network statistics. You know, inbound/outbound traffic, speeds, that kind of thing.

Well, on the Resources tab on System Monitor (accessible on System->Admnistration) you have that info. Probably you could have more info there, but for me it’s perfect, just what I was looking for.

I’m not going to get into the story of Open Sound System. Let’s just say that OSS was deprecated years ago and ALSA is the standard. Recently OSS was GPLed and now you can use it with no problems. The following was what I gathered about the subject, tested in Ubuntu 9.04 (linux mint 7 to tell the truth) on an Acer Aspire One. I sometimes reference things by wrong names by sheer ignorance, but you’ll get the idea. I present instructions for installation, configuring applications to work with OSS and a path to debug some of the most common problems encountered with OSS.

1.Why consider OSS

There are a number of reasons to consider using OSS in your system. Some say OSS has better sound quality, it’s hard to tell really. Some soundcards, of the more professional variety, are only properly supported with OSS. You know, 5.1 sound and the like. Some say it takes less resources, but really it’s nothing extravagant. A list of supported hardware can be found on this pdf.
A good reason to use OSS is to refuse to use ALSA+pulseaudio and avoid its problems. If you have propper support for your hardware in ALSA, then alright, ALSA works ok, but pulseaudio is just there to ruin your audio. Pulseaudio is the reason strange shit happens with sound. It’s why you experience sound clipping for no reason, it’s the reason skype audio breaks randomly on ubuntu 9.04, etc and etc ad absurdum. If you’ve used any distro with pulseaudio running on the background you have experienced problems with audio. There is no ideal pulseaudio set up, pulseaudio is a big piece of shit with useless features, it is the exact definition of bloatware and has random problems with no possibility of solution. With OSS you won’t have these problems. No, you’ll have a different set of problems. But hey, at least they are predictable and you might be able to solve them.

2. Why not consider OSS

OSS has its own issues. Assuming your hardware is supported, what will not work for sure is automatic headphone recognition and suspend/resume. Some workarounds are available, but it will not work out of the box.

The bigger problem with OSS though is support. It’s not supported very well. I mean support in terms of active development and integration with your desktop. Your system sounds will not work out of the box in GNOME. The base system itself is quite good and has extraordinary potential, but no one is really working on it to the fullest extent. The GUI mixer applet is just a proof of concept to be honest. Look at it

Oh boy

Oh boy

It tries to do inteligent things like calling pink-jack to your mic input, green jack to the headphone. The idea is brilliant, but it doesn’t work 100% and ends up being confusing. It is still better than alsa though. Consider this usual mess.

Just your everyday user-friendly, sane piece of software engineering. ALSA FTW!

Just your everyday user-friendly, sane piece of software engineering. ALSA FTW!

3.Getting it up and running


Installing OSS is pretty simple. If you haven’t tried OSS before, the more intelligent thing to do is disable ALSA and pulseaudio instead of uninstalling them. First thing is to blacklist all alsa sound modules using the two following commands

sudo cat /lib/linux-sound-base/noALSA.modprobe.conf >> /etc/modprobe.d/blacklist.conf

sudo echo "blacklist snd_hda_intel
blacklist snd_mixer_oss
blacklist snd_pcm
blacklist snd_timer
blacklist snd_page_alloc
blacklist snd_hwdep
blacklist snd
blacklist soundcore" >> /etc/modprobe.d/blacklist.conf # One whole command

Noticed that that last one should be on whole command, paragraphs and everything. Run this

sudo dpkg-reconfigure linux-sound-base

And choose OSS from the list. Now you have to reboot. If you would like to check if the ALSA modules have indeed not been loaded, try running lsmod.

Install all the needed dependencies like so

sudo aptitude install libtool libgtk2.0-dev libesd0 libsdl1.2debian-oss build-essential binutils linux-headers-`uname -r` gawk

Now you are ready to install. There is a deb package available. You can get it from the 4front website or directly here, the latest package as of the writing of this article. The recommended way to do it is installing the package using dpkg, for some reason the GUI app is said not to install it properly.

sudo dpkg -i oss-linux*.deb

And that’s that. OSS has been installed and should now be running. You can check it by running lsmod and checking for the new modules.

In system->preferences->sound you should change everything to OSS4 (if OSS4 is not available, then OSS will work too) like so

Notice the Default Mixer tracks

Notice the Default Mixer tracks

Note the last part, Default Mixer Track. When you change your volume using the volume applet, the volume you are changing is whatever track is choosen here.

This is what I mean

This is what I mean by volume applet

And we’re done.

Configuration and debugging

Now you will want to test your audio. This might be quite an involved process.

Flash 10 should be working out of the box if you have the package flashplugin-non-free-extrasound installed. If not working, try reinstalling the package. Totem should be working since the propper Gstreamer backend (packages gstreamer0.10-plugins-bad and/or gstreamer0.10-plugins-ugly). Regarding Wine, you need to change the sound driver to OSS in the Wine Configuration thing. Mplayer and vlc may have to be configured on their own options to have audio working. I will dedicate a whole section to Skype.

In case something’s wrong, here’s an explanation of some of the tools available, things you can do with them and things to look up. I will put them in an order that makes sense as a debugging procedure.

osstest is a command line utility that will play audio on all output devices avaialbe, it will run thru all devices registered in /dev/oss/oss_hdaudio/ (note that the last folder oss_hdaudio is driver specific). Running this will reveal if your soundcard is properly supported and the driver is properly installed. If you hear the audio test, then any playback problem lay elsewhere.

ossxmix is the mixer GUI you’ve seen a screenshot earlier. It looks pretty bad and confusing. There’s a couple of things I would like point out.
vmix stands for virtual mixer. This needs to be enabled for you to have multiple applications outputing audio at the same time, if you can’t play music in totem while watching a video a youtube, this is what you should be looking at. vmix0-src should be set to Production for the best sound quality possible. vmix0-outvol/-invol are respectively the volume of the ouput and the input, meaning playback and recording respectively. At the bottom you will see the mixer itself, several channels available and each application will connect to one of the channels. You can have one application occupy multiple channels, for instance, skype may use one input channel and one output and you will see both channels in the mixer. I don’t know as of now if there is a maximum number of channels and if you can do anything to change them. I still haven’t had any problems with that.
In the middle rows you will have the rest of the devices your soundcard is packing. It’s an enormous mess and the mess will be different from soundcard to soundcard, so I won’t go too deep on this. And note that by mess I don’t mean just mess in presentation, the driver itself may have some bugs and the controls will not work as intended or even in a logical way. To try to understand what is doing what, you can play some music in whatever program is working, play with the controls and see the changes in real time. It is useful to find out how to manually mute the internal speaker of your laptop, since like I mentioned, headphone detection doesn’t normally work. Microphone problems will be solved also by playing with the mixer, but the easiest way to use the mixer with ossrecord as I’ll explain in a second.

ossdevlinks shows the symlinks to which /dev/dsp* entries point. From what I understand, versions prior to OSSv4 used these /dev/dsp* entries, but in V4 they use different entries and basically the dsp ones link to the ones used in V4.  You need to run it as sudo and with the -v option, sudo ossdevlinks -v . Here’s an example output

4 audio devices
/dev/dsp4 is the next free legacy device
/dev/dsp0: symlink -> /dev/oss/oss_hdaudio0/pcm0 OK
/dev/dsp1: symlink -> /dev/oss/oss_hdaudio0/pcm1 OK
/dev/dsp2: symlink -> /dev/oss/oss_hdaudio0/pcmin0 OK
/dev/dsp3: symlink -> /dev/oss/oss_hdaudio0/pcmin1 OK

Here’s a brief explanation of what I understand of this output. pcm0/1 are respectively the internal speaker of my laptop and the headphone. I can see this by running osstest and checking wich pcm is which. So choosing the playback channel is done. pcmin0/1 are two available inputs, which in theory I would guess  should be the internal and the external mic. This is a bit more tricky, because in effect you can only select one mic at a time, which one is selected in the mixer.

This will come in handy to use ossrecord and to setup skype or any application that uses the dsp links.

ossrecord will record audio from the currently selected input device. An interesting way to use it is to redirect its output directly to ossplay like so

ossrecord - | ossplay -

Using this you can listen immediately to what’s being recorded. If you are having trouble with choosing the internal mic or the external mic in a laptop, for instance, with this command you can listen in real time to changes you make in the mixer. The problems you might be dealing with are a combination of muting and selection. Example, you might have the external mic selected, but if its muted you won’t hear a thing. Yep, it’s a mess.
In my case I was able to choose the external mic by doing the following irrational procedure

ossrecord -d/dev/dsp3 - | ossplay -

The -d option forces ossrecord to listen to a specific device. With dsp3,  selecting speaker/dmic I heard the external/internal mic respectively. Here’s a screenshot of what I mean.

There is no difference between this and something absolutely random

There is no difference between this and something absolutely random

Bottomline, by trial and error I found out that /dev/dsp3 is outputting the selected microphone in the mixer. Selecting the mic in the mixer was a shot in the dark. I knew which input devices were available by checking ossdevlinks and noticing that dsp2/3 were linked to pcmin0/1.

By  know you should’ve have mastered your soundcard if the installation went alright. There are still some things worth mentioning.

The volume applet is tricky. When you use your keyboard to change the volume it’s the same as changing it in the volume applet, and which mixer track this affects is chosen in the sound preferences dialog as I mentioned earlier. Going to volume control you will access the mixer. Since no more alsa and no more pulseaudio, you will have only one mixer available which is much more sane. This has basically the same options ossxmix has (note that you have to enable all the possible options choosing preferences and putting them all visible), but presented in a different way. I do not recommend using this, although it works, I do believe some options are missing, I recommend setting your audio using ossxmix.

ossmix is the command line mixer. Running ossmix will dump all the information ossxmix presents graphically. By using ossmix with some options, you can change the levels and switches you change in ossxmix. In theory, if you wish to have headphones automatically detected you should try to automatically run a specific command that mutes the laptop internal speaker when the headphone is detected. I have yet to find how to do this. Also, if you’d like to mute/unmute the internal speaker easily, you can try to do a script that toggles the value and then make a shortcut on the desktop that runs the script, enabling you to mute/unmute with a double click. I haven’t done this, but it shouldn’t be too difficult, it’s a basic if/then/else structure.

ossinfo will display information regarding the current configuration. Running ossinfo -v4 will display all available information.


I believe this is worth a section of its own. In case you’re running Ubuntu, you should have the medibuntu repository installed and this will provide the required packages. The skype package only supports ALSA/pulseaudio. If you have this installed and wish to start using OSS, uninstall the skype package and install skype-static-oss. As a side note, this version of skype will not blend in your GTK theme, it comes with a “static” qt configuration.
You will need to configure the audio. In the options you can see that the devices are referenced as /dev/dspX instead of a more user friend reference, like in the screenshot.

You think this is bad? Ever seen how it looks like with ALSA+pulse?

You think this is bad? Ever seen how it looks like with ALSA+pulse?

By know you should know how to deal with this. I have explained how to find out what the dsp links are referencing, which ones are input or output and how to test them in real time. Usually you’re sound out and ringing should be /dev/dsp, the sound in you should find out by using ossrecord.

3.Other problems and things I found out

Disabling vmix will make sound applications use much less cpu (around half), but you can one play one at a time. It is mentioned in this forum post that disabling vmix for recording channels will bring the cpu down. I honestly did not understand the procedure so well, what do you mean dettach then attach?bah, I think I did it but didn’t really see any effects.

Suspend/resume I did not find a solution. In theory, you should disable audio by running soundoff on suspend and renable it by running soundon on resume, and this implies altering whatever scripts are run in both operations. Does any one know how to this?

The workaround to enable gnome sounds is quite simple but I don’t remember where I saw it.

After I got everything working I purged pulseaudio from my system, but didn’t touch alsa. It should not be a problem.


I initially installed OSS to try to tackle 3 issues.
First, I noticed that pulseaudio was using a lot of CPU and I head that OSS used less resources. On the CPU level, I did not see any real difference, only with vmix disabled would CPU usage come considerably down. Some people report other results though.
Second, I use spotify to listen to music. With alsa/pulseaudio the sound was choppy, freezing at least twice every minute and it was annoying me. Changing the wine driver to OSS and running spotify with padsp, a wrapper for pulseaudio, brought the choppiness down but not completely and the CPU usage was very high. I expected that running OSS natively with solve all the problems. Well, CPU went to normal because you don’t need the wrapper anymore, choppiness went further down but never disappeared. I am still trying to figure out how to solve the issue.
Thirdly, skype in Ubuntu 9.04 is not working well. The sound freezes after a random amount of time and there is no definite solution. By the use of voodoo I was able to make it work, but honestly I don’t even remember what I did. With OSS skype works fine.
So, bottom line, after installing OSS runs quite well but it did not solve all my problems. I like that the mixing is less insane than with alsa+pulse, but it sadly has some problems and the GUI mixer is not intuitive by any means. Since I did a lot of research, I know that some soundcards are only supported by OSS and there isn’t any good in-depth guide I could find online, I decided to write this.

For further help, please check the 4front user forum. What this guide contains is basicaly all I know about OSS.


arch linux wiki
4front user forum

harshJ blog
Pdf from 4front
with installation instructions, hardware support and general overview of tools.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

This is gonna be a short one.

You probably heard the Firefox 3.5 has a new javascript engine which supposedly has greater performance than the current stable version of Firefox. If you tried it out probably you’ve been dissapointed. The difference is minimal, in practice it’s zero.

Because I’m a professional procrastinator I went thru the release notes of the 3.5 version. Turns out, the new javascript engine isn’t enabled by default because of it’s instability. To enable it just go to about:config and search for jit. Toggle the chrome variable to true and the engine will be activated.

The difference is huge. Try it out and see for yourself. The package is firefox-3.5

P.S. The blog has been a bit slow the last few weeks due to a shitload of work at university. A major blog post regarding performance is in the works that will blow the internet out of the water. Wait and see : -)

Long title. Here’s what happens if you try to open a usb image and the path to it contains spaces

IndexError: list index out of range

I’m not a big fan of this, but seriously? LOL. Now imagine you want to use it to write to a usb disk, just like that, out of the blue. You may get this output:

Executing: dd if=/media/LACIE/CDImages/moblin-netbook-ux-beta-20090518-004.img of=/dev/sdc
The dd process ended with an error !

And maybe you’re thinking, hm I hope it’s not anything serious. But if you try to run the command on the command line, the “error” is

dd: opening `/dev/sdc’: Permission denied

So guess what, if you start it with sudo before, problem solved. I say LOL.

Even a monkey can do better than this

Two options:


Can be edited with gedit for instance, not sure if you need root permissions.

If you’re only interested in changing the hostname that is sent, or rahter seen by, the network, you can change the dhcp settings.

In /etc/dhcp3/dhclient.conf you can see right after the initial comments this:

send host-name "<hostname>";

You edit it to something like

#send host-name "<hostname>";
send host-name "m4m";

You’re good to go.

Tags: , , , , , , , , , , , , , , , , ,