May 11, 2009

Solve no sound problem in Ubuntu

One after another 17 days have passed.. till today my laptop was completely silent when i booted into Ubuntu. But now, just 10 mins back, after a lot of hit and trial with driver model, I could make make my laptop speak. Here's what I did.
Though I specified this as ubuntu problem in title, it the problem of alsa; it's not recognizing your device.

I completely forgot what I did to mess up my laptop-sound-system, so i thought to start afresh.
I removed the alsa and pulseaudio completely. And One thing I would like to mention: I am completely unfamiliar about the interaction of alsa and pulseaudio with the sound system. This is my first deal with sound system of linux to this depth.
sudo apt-get --purge remove linux-sound-base alsa-base alsa-utils \
"pulseaudio-*"

Then I did a quick Reboot; just playing safe. (Jaunty boots on/off so fast, I am fan of it.)
Next I reinstalled the alsa with pulseaudio.
sudo apt-get install linux-sound-base alsa-base alsa-utils \
libasound2-plugins "pulseaudio-*" paman padevchooser \
paprefs pavucontrol pavumeter

Then, I appended following lines to the file /etc/modprobe.d/alsa-base.conf
alias snd-card-0 snd-hda-intel
alias sound-slot-0 snd-hda-intel
options snd-hda-intel model=dell-m6
options snd-hda-intel enable_msi=1

The bold faced "model=dell-m6" was the main hack for the system to work.

Then after another quick boot, I got the sound.

During this I refered a lot of pages, But the most useful and the one that is well documented is: Comprehensive Sound Problem Solutions Guide
And this is the page where I got the model of the sound-card(dell-m6) from.

Apr 30, 2009

Utilize Grep Sed and Awk

In this post I will list commands that I use and include at least one of grep,sed or awk.
  • cat filename | grep "phrase"
    Search line containing phrase in file
  • cat filename | grep -v "phrase"
    Search line not containing phrase in file
  • cat filename | grep "phrase1\|phrase2"
    Search lines containing phrase1 or phrase2 in file.
  • sed -i "s/phrase1/phrase2/g" ./filename
    Replace phrase1 with phrase2 in file.
  • sed -i "s/[ ]*\(.*\)[ ]*/\1/g" ./filename
    Trim spaces of each line of the file.
  • awk '{if($7=="2") $7="5"; print;}' file
    Conditional modification. Field no.7 is is replaced by "5" if it is "2". The default field seperator is .
  • uptime | awk 'BEGIN {FS=" "} { gsub(",",""); if (index($0,"day")) {gsub(":"," hours, ",$5);print $3" "$4", "$5" minutes"} else {gsub(":"," hours, ",$3); print $3" minutes"}}'
    Get the Uptime in a proper and clear format.
  • ls | grep -v 'file or folder or regex' | xargs -I{} mv {} /target/folder/
    Move all but one to /target/folder. You can also use it to move all the files/directories in current directory to another directory in the same path.Be Aware: The Target directory should exist. Just to be at the safe side, I suggest not to miss the slash (/) at the end. This will give you warning/error if you messed up something.


For now I have just listed few that came in my mind; just thought to prepare a seed.
I'll promise to grow this list as soon as they come to my mind.

Note: If you have some commands in your mind, that you regularly use, plz post it as comment.