Saturday, May 17, 2008

No sound on ASUS F3SC laptop with Ubuntu 7.04 or 8.04

Hi, thought I should share my problem - and the solution with the forum.

I assume, that you have checked that the speakers are not muted- OK - read on:


WARNING:
I'm a low-tech no-good son-of-a-newbie (have been for 7 years - the learning curve is steeeeeep) ... so please don't ask me a lot of hard questions: I got sound -> I'm happy!


PROBLEM:
No sound after installing Ubuntu 7.10 (Gutsy Gibbon) on new ASUS F3SC laptop.

HARDWARE AND SOFTWARE DETAILS:

Kernel version:
Code:
jospan@discworld:~$ uname -r
2.6.22-14-generic
ALSA version:
Code:
jospan@discworld:~$ cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version 1.0.14 (Thu May 31 09:03:25 2007 UTC).
The sound card:
Code:
jospan@discworld:~$ lspci -v | grep Audio
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)
The chipset on the sound card:
Code:
jospan@discworld:~$ cat /proc/asound/card0/codec#0 | grep Codec
Codec: Realtek ALC660-VD
Loaded sound driver:
Code:
jospan@discworld:~$ cat /proc/asound/modules
0 snd_hda_intel

SOLUTION:

Add the following line:
Code:
options snd-hda-intel model=lenovo
to the file /etc/modprobe.d/alsa-base (create the file if it does not exist)
..and yes: I know it says 'lenovo' and yes: I know my laptop is an ASUS!

Reboot and rejoice to the sound of the Ubuntu opening fanfare

Still no sound? - have you checked again that the speakers aren't muted? - Yes? - sorry, can't help you then...I'm the low-tech no-good son-of-newbie, remember?

By the way: I have also confirmed this solution when using Ubuntu 8.04 LTS (Hardy Heron) (ALSA driver 1.0.16) on the ASUS F3SC.



Taken From: http://ubuntuforums.org/showthread.php?t=728497

Tuesday, February 5, 2008

Environment Variables

LINUX BASICS

How Do I Set and Use Linux Environment Variables?

Environment Variables

Environment variables in the bash shell help you in several ways. Certain built-in variables change the shell in ways that make your life a little easier, and you can define other variables to suit your own purposes. Here are some examples of built-in s hell variables:


· PS1 defines the shell's command-line prompt.

· HOME defines the home directory for a user.

· PATH defines a list of directories to search through when looking for a command to execute.

To list the current values of all environment variables, issue the command

env

or list a specific variable with the echo command, prefixing the variable n ame with a dollar sign (the second line shows the result of the echo command):

echo $HOME
/home/hermie

You've already learned how to customize your shell prompt with the PS1 variable. The HOME variable is one you shouldn't mess with, because lots of programs count on it to create or find files in your personal home directory.

Understanding the Path Variable

As in DOS, the shell uses the PATH variable to locate a command. PATH contains a list of dir ectories separated by colons:

echo $PATH
/bin:/usr/bin:/usr/local/bin

When you enter a command, the shell looks in each of the directories specified in PATH to try to find it. If it can't find the command in any of those directories, you'll see a "Command not found" message.

If you decide to put your own programs in a bin directory under your home directory, you'll have to modify the path to include that directory, or the system will never find your programs (unless you happen to be in that directory when you enter the command). Here's how to change your PATH variable so it includes your personal bin directory:

PATH=$PATH:$HOME/bin

So if PATH was set to /bin:/usr/bin:/usr/local/bin beforehand, it would now have the value /bin:/usr/bin:/usr/local/bin:/home/hermie/bin.

Creating Your Own Shell Variables

If you are a programmer, you'll find it handy to create your own shell variables. First issue the command

code=$HOME/projects/src/spew

and then, regardless of what directory you are in, you can issue

cd $code

to pop over quickly to the directory containing the source code for that way-cool spew program you're developing. (The cd command means "change directory.")

A variable assignment like this will work just fine, but its scope (visibility) is limited to the current shell. If you launch a program or enter another shell, that child task will not know about your environment variables unless you export them first.

Unless you know for sure that an environment variable will have meaning only in the current shell, it's a good idea to always use export when creating variables to ensure they will be global in scope--for example,

export PS1="\u \$ "
export code=$HOME/projects/src/spew

And be sure to add these commands to your .profile file so you won't have to retype them eac h time you log in.


Taken from:
http://lowfatlinux.com/linux-environment-variables.html


Instead of using export to define the variables and to make them permanent, i think you can define these in the file /etc/environment.




Wednesday, November 28, 2007

How To Play RMVB (Real Media) in Mplayer

Mplayer by default doesn't play *.rmvb files, which are real player files, probably because the codecs are proprietary and because of that they can't be packed in the Mplayer basic codec pack.

Basically in this "how to" we are going to show how to add a additional pack of codecs (Windows codecs), in which the RMVB codec is included.

First off all, let's start by installing the Mplayer, using apt-get:

$ sudo apt-get install mplayer

Now that the mplayer is installed let's download the the pack, at:

ftp://opensys.linuxpackages.net/pub/Slackware-10.1/jay/mplayer/MPlayer_codecs-20050412-i686-1jto.tgz


Extract the MPlayer_codecs-20050412-i686-1jto.tgz like this:

$ mkdir /tmp/codecs
$ cd /tmp/codecs
$ tar -zxvf /.../MPlayer_codecs-20050412-i686-1jto.tgz

Now we have all the extracted content of MPlayer_codecs-20050412-i686-1jto.tgz in /tmp/codecs.

The next step is to copy the codecs to the rigth place, so that Mplayer can use them,
that place is the directory /usr/lib/win32 (which probably doesn't exist). To do that just do like this:


$ sudo mkdir /usr/lib/win32
$ sudo cp /tmp/codecs/usr/lib/codecs/* /usr/lib/win32

And that's it, now you can play RMVB files along with many others.

Just one more thing, cleaning up the extracted codecs:

$ sudo rm -rf /tmp/codecs

All set! Enjoy :)

Thursday, August 2, 2007

Tunelling P2P (Bitorrent) Over SSH

Have you ever been on a network somewhere where Bittorrent simply doesn’t work? The ports might be blocked, the packets are inspected, etc…? Well, after a little research and a buck i’ve managed to come up with a pretty good solution. I’d heard about tunneling content through SSH, but never really figured out how to get it working. That is, until now.

I was really excited my first day at Blue Lava when I heard that they had a 20mbps connection. I was told I could download full Linux ISO’s in ten minutes. Pretty quick. Sadly the ports for Bittorrent were blocked and my downloading spree never began.

Right now I am sitting in a Starbucks right near the south shore of Oahu, Hawaii. I’ve got Azureus open and its downloading at a steady pace of 170kbps, I’ve pretty much maxxed out the connection over here. The funny (or cool) thing is, the ports are blocked! So how can you bypass your corporate firewall or public hotspot (like Starbucks T-Mobile WiFi) and work out your download muscle? Read on!

First of all, you are going to need some sort of shell account to tunnel everything through. I’ve already tried using my Silenceisdefeat account, but their SSH server is not configured the way that we want it, so that won’t work. A friend of mine told me about Disflux, a service almost exactly like Silenceisdefeat. Disflux has their SSH servers configured the way we want em though, so that is what we are going to use.

UPDATE: Turns out that Disflux died or something. But! Don’t flip out! As it turns out (Thanks Chris! - #19) Silenceisdefeat.org, which is my choice of shell anyway, does work with this guide. However, it will only work if you connect to ssh.silenceisdefeat.org!

So I shelled out the $1 for my disflux Silenceisdefeat.org shell account (I actually already had one, best thing ever), and went on my merry way figuring out how to configure everything else. Some may think that paying for something like this is nuts, but honestly, Bittorrent has become a part of my everyday life, I depend on it like a crack addict depends on his crack. One buck is totally worth the hours of glee BitTorrent has to offer.

First thing you need to do after buying your shell account is open up a terminal (in OSX its in the Utilities folder), or download putty if you’re on Windows. If you are on Linux and don’t know how to open a terminal I feel sorry for you.

In the terminal type “ssh username@domain -D portnumber”, this goes for OSX and Linux. Now, with PuTTY on Windows I am not quite sure how to go about doing this. I am pretty sure you would just type “-D portnumber” into a extra flags option box or something, but I am really not quite sure. Edit: Scroll down for Eberth’s Windows guide! Or you lazy people can clicky.

For example, I use: “ssh whalesalad@ssh.silenceisdefeat.org -D 7777″. You can use any port you want, but make sure it isn’t being used by anything else. I happen to like the number 7777 so thats what I chose.

Screenshot_3.png

NOTE: In the screenshots Disflux is used, simply replace shelly.disflux.com with ssh.silenceisdefeat.org after creating an account and you will have no problems!

Now, what does this do? This has your open SSH session act as a SOCKS proxy. This is what we are going to have Azureus or any other bittorrent client of choice use.

-----------------------------------------------------------------------------------------------------------------------
In detail the -D [bind_address:]port option does the following:

Specifies a local “dynamic” application-level port forwarding.
This works by allocating a socket to listen to port on the local
side, optionally bound to the specified bind_address. Whenever a
connection is made to this port, the connection is forwarded over
the secure channel, and the application protocol is then used to
determine where to connect to from the remote machine. Currently
the SOCKS4 and SOCKS5 protocols are supported, and ssh will act
as a SOCKS server. Only root can forward privileged ports.
Dynamic port forwardings can also be specified in the configura‐
tion file.

----------------------------------------------------------------------------------------------------------------------------


Once that terminal is open, just minimize or hide it, but leave it open. The proxy will only work if that terminal is open and connected, so try not to fiddle with it.

Now we have to configure our BitTorrent client of choice. I recently “switched” to OSX and am using Azureus, but if I had my way I would be using the greatest client ever: uTorrent. Because I can’t get the internet working in Paralells at the moment I can’t help explain how to configure uTorrent, but here is what you need to do to get Azureus up and running with our newly created SOCKS proxy.

First of all you need to enable the Advanced options area of Azureus. You can do this by re-running (or running if this is your first time using Azureus) the configuration wizard. On OSX this is under the Azureus menu, I’m not quite sure where it is on Windows (=P). Choose the advanced user option, this will let us configure Azureus to use proxies. Once this is done, open up the preferences area of Azureus.

Screenshot_4.png

From there open up the “Connection” sub items and then the “Proxy Options”. From there, check the “Enable proxying of tracker communications” and “I have a SOCKS proxy”. In the host field enter “localhost” and in the port field enter whatever number you used to start the proxy, for me thats “7777″.

Save your options and thats it! Now you should be able to head to any one of the online tracker websites and download away! Legal files of course, we don’t encourage piracy or stealing here at the salad. Make sure to leave comments if it works for you, and any other tips or tidbits you’d like to share!


Edit: For all you windows users out there, Eberth made a comment below on how to get this working. He did such a good job, I’m going to include it right here in my guide.

First you need to get PuTTY. It’s a great client, back when I used Windows it was my SSH client of choice. You can find a direct link to PuTTy here.

Open up PuTTY and enter shelly.disflux.com into the host field.

Go to Connection > SSH > Tunnels, and write your port on the source port field (in this case i’m using the same as Michael, 7777) and select the “Dynamic” checkbox, click the add button.

I’d reccomend what Eberth explains in his comment, which would be to save your session so that next time you can just fire up PuTTY and double click your saved session to reload the same settings. Enter a name for the saved session and click save, its as easy as pie!

Now you’ve got your SOCKS proxy running, time to fire up your favorite BitTorrent client. Azureus users can use the same configuration that I have above, but if you’re smart you’re going to be using uTorrent. Here is a screenshot of the way Eberth configured his client:

Thanks Eberth!


Based on: http://www.whalesalad.com/2006/08/27/tunneling-bittorrent-over-ssh/

Friday, July 27, 2007

Gnome/Nautilus and Mozilla Shortcut Keys

Here are some very handy shortcut keys for Gnome/Nautilus an Mozilla you might not now.

nautilus / gnome:

ctrl-h : show hidden files

ctrl-t : move to trash

f9 : toggle side-pane

alt-home : jump to home folder

alt-enter : file / folder properties

alt-f1 : launch applications menu

alt-f2 : launch “run application” dialogue

ctrl-alt - right/left arrow : move to the next virtual desktop

ctrl-alt-shift - right/left arrow : take current window to the next virtual desktop

ctrl-atl-l - to lock your screen while you are away

firefox:

ctrl-k : firefox search field

ctrl-l : firefox address bar

ctrl-pgup : next tab (left to right)

ctrl-pgdn : previous tab (right to left)

ctrl-t : new tab

ctrl-r / f5: reload page

ctrl-u : view page source


Based on: http://ubuntu-tutorials.com/2007/02/20/shortcut-keys-you-might-not-know-about/

Sunday, July 15, 2007

Sistema de ficheiros /proc

Hugo Cisneiros, hugo@devin.com.br
Última atualização em 06/02/2003

O sistema de arquivos /proc é um diretório especial onde fica todas as informações de depuração do kernel. Também se encontram algumas configurações que habilitam e desabilitam o suporte à alguma coisa no kernel. É muito útil para o diagnóstico do seu hardware. Vou aqui comentar arquivos do /proc para você 'depurar' o seu hardware:


  • /proc/devices
    Aqui estão os dispositivos encontrados no seu sistema, incluindo modem, placa de som, placa de rede, teclado, impressora, etc.
  • /proc/interrupts
    Neste arquivo estão as informações das IRQs dos dispositivos.
  • /proc/ioports
    Informações sobre os endereços das portas I/O (Input/Output).
  • /proc/pci
    Dispositivos PCI instalados no sistema. O comando 'lspci' também serve para mostrar esse arquivo.
  • /proc/cpuinfo
    Aqui você pode ver as características do seu processador e máquina.
  • /proc/filesystems
    Sistemas de arquivos suportados pelo kernel.
  • /proc/devices
    Dispositivos gerais instalados.
  • /proc/meminfo
    Informações da memória usada. O comando 'free' também serve para mostrar este arquivo.
  • /proc/modules
    Módulos carregados no kernel. O comando 'lsmod' também serve para mostrar este arquivo.
  • /proc/mounts
    Partições montadas. O comando 'mount' sem parâmetro nenhum mostra esse arquivo.
  • /proc/partitions
    Partições existentes e que o Linux reconheceu.
  • /proc/version
    Versão do kernel. O comando 'uname' também serve para mostrar este arquivo.

    Explore este diretório! Só não dê um cat no arquivo /proc/kcore, por favor! :) kcore = kernel core.

  • Tirado de: http://www.devin.com.br/eitch/fsproc/
  • Permissões de directorias e ficheiros em Linux

    Hugo Cisneiros, hugo@devin.com.br
    Última atualização em 06/02/2003

    No Linux, como em outros sitemas Unix, cada arquivo tem uma permissão. As permissões são atributos dos arquivos que especificarão se ele pode ser lido, executado ou escrito. Estas permissões que vão definir o que um usuário pode fazer. Para saber se um programa é executável ou não, execute um 'ls -l' e veja no lado esquerdo se o arquivo tem X nos seus argumentos, como no exemplo abaixo:

    drwxr-xr-x   2 root     root         1024 Dec 23 15:22 bin
    drwxr-xr-x 2 root root 1024 Dec 31 05:48 boot
    drwxr-xr-x 2 root root 1024 Dec 6 15:51 cdrom
    drwxr-xr-x 3 root root 8192 Mar 11 10:17 dev
    drwxrwxr-x 2 root root 1024 Feb 27 13:52 dosa
    dr-xr-xr-x 11 root root 2048 Mar 11 10:19 etc
    drwxr-xr-x 11 root root 2048 Feb 23 19:08 home
    drwxr-xr-x 3 root root 1024 Feb 23 19:13 lib
    drwxr-xr-x 2 root root 12288 Nov 2 11:25 lost+found
    -rwxr--r-- 1 root root 57 Mar 10 03:44 make-backup
    -rw-rw-r-- 1 killer users 2342 Mar 10 03:12 teste.txt
    -rw-rw-rw- 1 hugo visits 23412 Mar 09 22:22 teste2.doc

    No exemplo acima todos os arquivos tem como dono root e como grupo também root, com exceção do 'teste.txt' que o dono é 'killer' e o grupo é 'users', e também 'teste2.doc', no qual 'hugo' é o dono e o grupo 'visits' também é dono. Como você pode ver do lado esquerdo de cada arquivo/diretório existe um série de letras r, w, x ou d! Vamos ver o que representa cada uma delas:

    drwxrwxrwx
    0111222333

    No caso acima, a primeira coluna significa (numero 0) se o nome listado é um diretório ou não, caso não seja um diretório ele será exibido da seguinte maneira:

    -rwxr--r--   1 root     root           57 Mar 10 03:44 make-backup
    \--------> Não contém a letra 'd', não é diretório, e sim arquivo

    O exemplo abaixo mostra o que seria um diretório:

    drwxr--r--   1 root     root            1 Mar 10 01:12 bin
    \----------> Contém a letra 'd' na primeira coluna, é um diretório

    Também há casos em que no lugar do 'd', aparecem outras letras que indicam outros tipos de arquivos. A letra 'l' significa que é um link simbólico, as letras 'c' e 'b' correspondem à dispositivos (/dev). Veja alguns exemplos abaixo:

    crw-rw----   1 hugo     audio     14,   4 Dec  2  1999 audio
    brw-rw---- 2 hugo cdrom 22, 64 May 5 1998 hdd
    lrwxrwxrwx 1 root root 8 Oct 17 22:53 cdrom -> /dev/hdd

    Continuando, na segunda coluna (números 1 de acordo com o exemplo mais acima) temos as definições para o dono do arquivo, como mostra o exemplo:

    -rwxr--r--   1 killer   users        1231 Mar 09 12:12 teste.txt
    ||\--------> O dono do arquivo (killer) pode executar o arquivo, x=executable!
    |\---------> O dono do arquivo (killer) pode gravar no arquivo, w=writable!
    \----------> O dono do arquivo (killer) pode ler o arquivo, r=readable!

    Seguindo, na terceira coluna (números 2 de acordo com o exemplo lá em cima) temos as definições para o grupo que é dono do arquivo, como mostra o exemplo:

    -r--rwxr--   1 fernando visits        212 Mar 01 12:42 exemplo.doc
    ||\-----> O grupo dono do arquivo (visits) pode executar o arquivo!
    |\------> O grupo dono do arquivo (visits) pode gravar no arquivo!
    \-------> O grupo dono do arquivo (visits) pode ler o arquivo!

    Finalmente, temos a quarta coluna (composto pelos números 3), essa coluna se refere as permissões para todos os outros usuários do sistema, sem ser os donos e grupos-donos dos mesmos, exemplo:

    -r--r--rwx   1 fernando visits       1231 Mar 03 12:42 exemplo2.doc
    ||\--> Todos os usuários (exceto fernando e usuários do grupo visits)
    || tem permissão para acessar o arquivo!
    |\---> Todos os usuários (exceto fernando e usuários do grupo visits)
    | tem permissão para gravar no arquivo!
    \----> Todos os usuários (exceto fernando e usuários do grupo visits)
    tem permissão para ler o arquivo!

    Quando nos referimos a diretório invés de arquivos, o FLAG x (executável) diz se o diretório é ou não acessível, já que não podemos "EXECUTAR" diretórios... Exemplo:

    drwxr--r-- 1 root       root         2134 Mar 01 12:54 exemplo3
    ||||| \----> Todos os usuários podem ler o interior do diretório, mas não
    ||||| podem usar o comando 'cd' para entrar nele, pois não existe
    ||||| o FLAG 'x' para a quarta coluna!
    ||||\-------> Usuários do grupo 'root' podem ler o interior do diretório,
    |||| mas também não podem usar 'cd' para entrar no diretório!
    |||\--------> O usuário 'root' pode usar 'cd' para entrar no diretório!
    ||\---------> O usuário 'root' pode gravar arquivos nesse diretório!
    |\----------> O usuário 'root' pode ler o interior desse diretório!
    \-----------> Indica que o nome listado é um diretório!

    O comando chmod pode ser usado para mudar os FLAGS 'rwx' dos arquivos e/ou diretórios, a sintaxe básica do comando é:

    chmod [ugoa]{-+}[rwx] nome_do_arquivo_ou_diretório

    Então vamos à um exemplo. Se eu quero mudar a permissão para o dono do arquivo (u=user) poder ler e gravar (rw) no 'arquivo1.txt', faço o seguinte:

    $ chmod u+rw arquivo1.txt

    Caso você queira desfazer o comando, você faria: "chmod u-rw arquivo1.txt". Como se vê, o + ou - define se os FLAGS serão ativados ou desativados! Outros exemplos:

    $ chmod a+r arquivo2.txt

    (Todos usuários (a=all) podem ler o 'arquivo2.txt')>

    $ chmod o+w arquivo3.txt

    (Outros usuários (o=others) sem ser o dono e o grupo dono do arquivo, podem gravar no 'arquivo3.txt')

    $ chmod g+x netscape

    (O grupo-dono do arquivo (g=group) pode executar o arquivo 'netscape')

    O comando chmod pode também ser usado com números, em vez dos flags. Este método é chamado de octal, veja o exemplo abaixo:

    $ chmod 664 arquivo.txt

    O que quer dizer cada um desses números? Veja abaixo:

    Número Significado
    0 Nenhuma permissão
    1 Permissão para executar
    2 Permissão para gravar
    3 Permissão para gravar e executar
    4 Permissão para ler
    5 Permissão para ler e executar
    6 Permissão para ler e gravar
    7 Permissão para ler, gravar e executar

    No exemplo o comando informou que o 'arquivo.txt' pode ser lido e gravado pelo seu dono (numero 6 na primeira coluna), informou que pode também ser lido e gravado pelos usuários que compõem o grupo-dono (numero 6 na segunda coluna), e informou que pode ser lido por todos os outros usuários do sistema (numero 4 na ultima coluna).

    O comando chown é simples e pode ser usado para mudar o dono e o grupo dono de um arquivo/diretório. E é usado da seguinte maneira:

    $ chown usuario.grupo arquivo_ou_diretorio

    Como exemplo, vamos definir que um arquivo 'teste4.txt' terá como dono 'killer' e como grupo 'users':

    $ chown killer.users teste4.txt

    Outros exemplos:

    $ chown mrdvs.visits teste5.txt
    $ chown hugo.users teste6.txt
    Hugo Cisneiros, hugo_arroba_devin_ponto_com_ponto_br

    Tirado de: http://www.devin.com.br/eitch/permissoes/