Wednesday 29 January 2014

Hardware and Drivers on Linux

How to see hardware details

An easy way is to see it using a GUI:
a) $ sudo apt-get install hardinfo
b) $ sudo apt-get install sysinfo


When thebrigthness does not work properly:
http://www.vivaolinux.com.br/topico/Ubuntu-Ultimate/Ajuste-do-brilho-da-tela


Some very usefull linux commands to see hardware/drivers details, (overall or specific)
http://www.linuxnix.com/2009/09/how-to-get-bios-firmware-and-installed-drivers-details.html
http://www.linuxnix.com/2013/05/find-hardware-info-with-lshw-hardinfo-sysinfo-linuxunix-commands.html


For more specific information about drivers, use command dmesg:
dmesg will give us details about hardware drivers connected to, disconnected from a machine and any errors when hardware driver is loaded into the kernel
http://www.linuxnix.com/2013/05/what-is-linuxunix-dmesg-command-and-how-to-use-it.html

LSPCI
To see several details of the pci slots such as network card, sound card, etc:
http://www.linuxnix.com/2013/05/find-hardware-details-using-lspci-command-in-linux.html

$ lspci, all information together
lspci   -vmm   -->Shows Information in a more understandable format.


Driver
To see the, Kernel driver in use, add the -v parameter

For example, here we can see the details of a wireless device that present an error. Actually the wireless was not working on that moment.

$ lspci -v
       .........
08:00.0 Network controller: Intel Corporation Centrino Wireless-N 2230 (rev c4)
Subsystem: Intel Corporation Centrino Wireless-N 2230 BGN
Flags: fast devsel, IRQ 47
Memory at c1500000 (64-bit, non-prefetchable) [disabled] [size=8K]
Capabilities: [c8] Power Management version 3
Capabilities: [d0] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [e0] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Device Serial Number 60-6c-66-ff-ff-43-d3-ed
Kernel driver in use: iwlwifi

Details for lsusb
http://www.linuxnix.com/2013/05/find-usb-device-details-in-linuxunix-using-lsusb-command.html


Modprobe

How to see the modules or driver installed, add and remove new ones.
http://www.thegeekstuff.com/2010/11/modprobe-command-examples/


Monitor commands  
Use the command watch http://www.linuxnix.com/2013/05/linux-watch-command-to-monitor-a-command.html
$ watch ifconfig


RAM
Use command free to understand details about ram http://www.linuxnix.com/2013/05/find-ram-size-in-linuxunix.html
$ free
More about ram  http://www.linuxnix.com/2013/05/find-ram-details-in-linuxunix.html


Network
http://www.linuxnix.com/2013/06/find-network-cardwiredwireless-details-in-linuxunix.html

$ ip link show  -> will show details about the active connection : state DOWN or state UP


Details about a network card driver
............:~$ ethtool -i wlan0
driver: iwlwifi
version: 3.8.0-35-generic
firmware-version: 18.168.6.1
bus-info: 0000:08:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no


* Complete network card software details like speed, modes, negotiations, link status etc.
.....$ ethtool eth0

* Complete network card hardware details.
....$  lshw -class network


Finally to detect errors,  you can run complete test from ubuntu for example from gui. It will internally run several of the command above.
Just write "System Testing" on ubuntu where you find for programs and click on continue and so on.


Note: You can use grep in your commands to filter lines and just see what is interesting for you.
Ex 
$ grep "boo" file.html -> will find all the lines that have boo inside the file file.html
$ grep -v "boo" file.html -> will do the opposite. It will return all line except the ones that have boo.

Saturday 25 January 2014

Adding Java to several browsers

According to the official Java documentation, since  the Java SE 6 update 10 release , Oracle introduced the a new Java Plug-in designed to work in the following browsers:
  • Internet Explorer 6 and 7 on Windows XP and Vista
  • Firefox 3 and up on Windows XP, Windows Vista, Solaris and Linux

Installation
When you download Java (jdk or jre), you will have a file called libnpjp2.so.
Take into account that in a i386 architecture, its path would be something like
<JDK>/<JRE>/lib/i386/libnpjp2.so

In contrast, in a amd64 architecture, the path would be something like:

<JDK>/<JRE>/lib/amd64/libnpjp2.so 
 
That file have to be located inside the adequate directory of the corresponding browser and that is all.
Here you have the details depending on your browser:

1) Firefox
 * Go to the adequate firefox directory
   a) Find the application's general directory and enter to the plugins subdirectory
       or
   b) Go to the directory from your home ~/.mozilla/plugins

* Create a symbolic link inside plugins where the necessary file libnpjp2.so from java is pointing to that plugins subdirectory.
  ln -s  <JDK>/<JRE>/lib/i386/libnpjp2.so . 
   
* Restart firefox.

2) Chrome
* Go to the adequate directory
      cd /opt/google/chrome/plugins/ 
(if plugins subdirectory does not exist, create it.)

* Create a symbolic link inside plugins where the necessary file libnpjp2.so from java is pointing to that plugins subdirectory.
   ln -s <JDK>/<JRE>/lib/i386/libnpjp2.so .

Note: O Chrome não suporta o Java 7 na plataforma Mac. 


3) Opera
* Go to the adequate directory
      cd /usr/lib/opera/plugins
* Create a symbolic link inside plugins where the necessary file libnpjp2.so from java is pointing to that plugins subdirectory.
   ln -s <JDK>/<JRE>/lib/i386/libnpjp2.so .
 



In order to test if your browser has already java, you can go to:
https://java.com/en/download/installed.jsp
and click in the "Verify Java version" button

That's all, restart your browser and you will have java working properly.

Monday 20 January 2014

Avoiding certificate verification on a wireless connection

1. Go to /etc/NetworkManager/system-connections
2. Find your connection name
3. Edit the file which has the name of your connection.
4. In order to avoid verification, change the line
system-ca-certs=true
by
system-ca-certs=false
5. Try now.