View your current network settings with nm-tool

A short post to tell you about a tool named nm-tool. Use nm-tool to display your current network settings. nm-tool is installed as part of the NetworkManager package.

Ubuntu: network-manager package
Fedora: NetworkManager package

As you can see it returns a lot of useful information.

$ nm-tool
NetworkManager Tool
State: connected
- Device: eth0  [Auto eth0] ----------------------------------------------------
 Type:              Wired
 Driver:            r8169
 State:             connected
 Default:           yes
 HW Address:        00:24:8C:95:28:BF
 Capabilities:
 Carrier Detect:  yes
 Speed:           100 Mb/s
 Wired Properties
 Carrier:         on
 IPv4 Settings:
 Address:         192.168.140.11
 Prefix:          24 (255.255.255.0)
 Gateway:         192.168.140.1
 DNS:             192.168.140.19
 DNS:             192.168.140.9
- Device: wlan0  [Auto stargate] -----------------------------------------------
 Type:              802.11 WiFi
 Driver:            ath5k
 State:             connected
 Default:           no
 HW Address:        00:11:6B:62:22:4C
 Capabilities:
 Speed:           54 Mb/s
 Wireless Properties
 WEP Encryption:  yes
 WPA Encryption:  yes
 WPA2 Encryption: yes
 Wireless Access Points (* = current AP)
 stargate:        Infra, 00:14:D1:4E:40:EE, Freq 2437 MHz, Rate 54 Mb/s, Strength 48 WPA2
 *stargate:       Infra, 00:1C:F0:5F:78:A5, Freq 2412 MHz, Rate 54 Mb/s, Strength 90 WPA2
 stargate:        Infra, 00:14:D1:4E:40:EE, Freq 2462 MHz, Rate 54 Mb/s, Strength 45 WPA2
 IPv4 Settings:
 Address:         192.168.142.106
 Prefix:          24 (255.255.255.0)
 Gateway:         192.168.142.1
 DNS:             192.168.140.19
 DNS:             192.168.140.9
Advertisements

Wacom Bamboo CTL460 diagnostics using xidump

I’m going to show you a program called xidump that comes with the Wacom driver.  I use it to view raw data from my Wacom tablet.

Some of the data you can see are:

  • Pen coordinates
  • Amount of pressure
  • Pen Proximity events
  • Button events

I must assume that you already have a working Wacom tablet and that you are using the Wacom driver from Sourceforge.  If not, see my previous post on the subject.  The current driver as of this writing is linuxwacom-0.8.7.tar.bz2

Go to the folder where you downloaded the Wacom driver source.  If you don’t have the driver source anymore, then download it again from the link above.

Extract the driver source.  The xidump program is already prebuilt, therefore you won’t be compiling anything.  It is ready to use.


$ tar jxvf linuxwacom-0.8.7.tar.bz2

$ cd linuxwacom-0.8.7/

If your system is 32-bit, then use the 32-bit xidump.


$ cd prebuilt/32

If your system is 64-bit, then use the 64-bit xidump


$ cd prebuilt/64

If your Wacom table it not connected, please connect it now.  List the available input devices.  If you have the CTL460, like I do, you will be using the device named “Wacom Bamboo 4×5 Pen”


$ ./xidump -l
Virtual core pointer           disabled
Virtual core keyboard          keyboard
Virtual core XTEST pointer     extension
Virtual core XTEST keyboard    extension
Power Button                   extension
Power Button                   extension
Microsoft Comfort Curve Keyboard 2000 extension
Microsoft Comfort Curve Keyboard 2000 extension
Microsoft Basic Optical Mouse  extension
Macintosh mouse button emulation extension
Wacom Bamboo 4x5 Finger pad    extension
Wacom Bamboo 4x5 Finger        extension
Wacom Bamboo 4x5 Pen eraser    extension
Wacom Bamboo 4x5 Pen           extension

Let’s run xidump and view some raw data.  If you have a different tablet than the CTL460, then you will see a different list of device names.  Determine which device name applies to your model using trial and error, if it’s not obvious to you.


$ ./xidump "Wacom Bamboo 4x5 Pen"

After running xidump, pick up the pen and begin using it with your tablet.  You should see a screen like the following in your terminal.

Viewing raw data with xidump

The picture above shows the current coordinates of my pen.  It shows the maximum values.  You can see that I was applying a pressure of 491, which almost half of the maximum pressure value of 1023.  The 01-DOWN event  means that the pen was touching the tablet surface rather than hovering above.  You can use this tool to test various pen and tablet features, while you are using your tablet with other applications such as Gimp.  When you are done, use ctrl-c in the terminal window to terminate program.

Howto: Install Sun Java on Ubuntu 10.04 Lucid Lynx

Sun Java and the Sun Java browser are not installed by default on Ubuntu 10.04 lucid lynx.  Instead, Ubuntu uses the OpenJDK and the Icedtea web browser plugin.  Typical users may never notice a difference as OpenJDK works well in most cases.

However, you may find that you need the real Sun Java instead of the open substitutes.  I will show how to completely remove the OpenJDK packages and how to install the real Sun Java packages.

To completely remove the OpenJDK and Icedtea packages

I removed OpenJDK and IcedTea6 packages with the following command.  On my server, this removed a total of 8 packages.   Before answering “Y” to the following command, look at the full list of packages that it will be removing .   It will attempt to remove other packages which have a dependence on Java.  If you are uncomfortable with some of them, then you should  skip the removal step and move on to the next step and install SUN Java alongside OpenJDK.  The final step will allow you to select Sun Java as the default.

$ sudo apt-get purge openjdk-6-jre openjdk-6-jre-headless
Reading package lists... Done

The following packages will be REMOVED:
ca-certificates-java* icedtea-6-jre-cacao* icedtest6-plugin*
libaccess-bridge-java* libaccess-bridge-java-jni* openjdk-6-jre*
openjdk-6-jre-headless* openjdk-6-jre-lib*

0 upgraded, 0 newly installed, 8 to remove and 48 not upgraded.
After this operation, 87.5MB disk space will be freed.
Do you want to continue [Y/n]? Y

Enable the Canonical partner repository

The Sun Java packages are found in the Canonical partner repository.  Add the partner repository to your repository sources.


$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid  partner"
$ sudo apt-get update

Install the Sun Java packages

Now install the Sun Java packages.  Most people will need only the following packages:

  • sun-java6-jre
  • sun-java6-plugin
  • sun-java6-fonts

$ sudo apt-get install sun-java6-jre sun-java6-plugin
$ sudo apt-get install sun-java6-fonts

If you think that you will need the Java development kit, then add sun-java6-jdk to the list.

  • sun-java6-jre
  • sun-java6-plugin
  • sun-java6-fonts
  • sun-java6-jdk

$ sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-jdk
$ sudo apt-get install sun-java6-fonts

Now set your system to use the Sun Java JRE and Dev packages as the default


$ sudo update-java-alternatives --set java-6-sun

Be sure to restart your web browser so that it will be able to use the sun-java6-plugin.  If you want to verify your version of java then you can do:

$ java -version

If you would like to verify that your web browser java plugin is working, then open your web browser  here

Click on the “Verify Java version” button.

Verifying that the java browser plugin is working

That is all.

Change the login screen background in Ubuntu 10.04

I used to have a custom background setup on my Ubuntu 9.10 system.  My login screen background was reset to the default purple background after upgrading to Ubuntu 10.04.  If you want to setup a custom login screen background there are (at least) two methods.

Method 1

Install Ubuntu Tweak.  Ubuntu Tweak will let you tweak many things including the login screen background.

Ubuntu Tweak

To install Ubuntu Tweak add the third party repository to your list of repositories.

Go to System-Administration-Software Sources, Third-Party Software tab, Add:

 deb  http://archive.getdeb.net/ubuntu lucid-getdeb apps

Add the repository GPG key, open a terminal window and type:

 $ wget -q -O-  http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -

Install ubuntu-tweak from the command line.

$ sudo apt-get update
$ sudo apt-get install ubuntu-tweak

Method 2

Copy your favorite background .jpg file to /usr/share/backgrounds


$ sudo cp  my_cool_bg.jpg /usr/share/backgrounds

$ sudo cp /usr/share/applications/gnome-appearance-properties.desktop /usr/share/gdm/autostart/LoginWindow

Logout

You should see an “Appearance Preferences” window, select the Add button and select the .jpg file that you want for your login screen background.  Close the window.

Appearance Preferences

Login again and remove the gnome-appearance-properties.desktop file that you copied in the previous step.  This will prevent you from getting the appearance-properties windows at every gdm login.


$ sudo rm /usr/share/gdm/autostart/LoginWindow/gnome-appearance-properties.desktop

Which method should you use?  If you really enjoy customizing your GUI and changing its behavior, then use Method 1 and install Ubuntu Tweak and enjoy having the control over many settings within easy reach.

Make You Own QR Codes

QR codes are also known as “Quick Response” codes.  It is  a 2D matrix type of bar code.  The QR code was originally  invented by a subsidiary of Toyota to manage automobile parts.  The QR code is now public domain and you have probably seen them a number of places, on product packaging, bill boards, in magazine ads, and on-line.  The most common use for them now days is to encode URLs, and addresses.  They are meant to be quickly scanned and read by the camera in your cell phone.  If you have an Android, or an Iphone you have a built-in bar-code scanner that can process the URL stored in these QR codes.

The image below is a QR code that encodes the URL of this website.  If you scan it with the camera in your smart-phone, it should recognize the encoded URL https://nfolamp.wordpress.com and offer you the option of opening your browser to take you there.

QR code for this website

My QR code was created using the following URL:

http://chart.apis.google.com/chart?chs=100×100&cht=qr&chl=https://nfolamp.wordpress.com

You can create your own QR code using the  Google charts tool.   Google charts are an API which allow you dynamically generate charts using a URL and embed them into your web pages.  Use the Google chart URL shown above.  The parameter cht=qr, indicates that this is to be a QR code.  The parameter chs=100×100 is the size.  Change it if you want to change the size.  Use the chl= parameter to indicate the URL that you want to encode.

Google charts is a very powerful tool.  Although  my example demonstrated only  how to create a QR code chart, the number of different types of charts you can create using the Google API is very impressive.   I encourage you to check out the Google charts playground tool and experiment with creating different types of charts.

Growing your RAID array

This is part 3 of a series of posts regarding setting up a linux RAID 5 disk array.  Let’s say you started your disk array with three drives and now you have more funds and you purchased an additional drive to increase the size of your disk array.  Adding a fourth drive to a three drive RAID 5 array will increase your storage space by 50%.  So you get a lot of bang for your buck.

Let’s continue with my example.  I started with three 1 TB SATA drives and now I’m adding a fourth 1 TB drive.  Before I had approximately 2 TB of storage, and after adding this fourth drive, I will end up with approximately 3TB of storage space.

Here are the basic steps that I will cover:

  • Partition the bare drive
  • Add the drive to your array as a spare
  • Grow your array to include this spare
  • Extend your file-system to recognize this additional space
  • Save your new configuration

First lets create an “auto-detect” partition on the bare drive.  You have seen this step before, I’ll include it again to refresh your memory.  This step is essential.

$ sudo fdisk /dev/sde
Command (m for help): n
Command action
    e   extended
    p   primary partition  (1-4)
p
Partition number (1-4): 1
First cylinder (1-133674, default 1);
Using default value 1
Last cylinder, +cylinder or +size{K,M,G} (1-133674,  default 133674):
Using  default value 133674

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid  autodetect)

Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

$ sudo fdisk -l
Disk /dev/sde: 1099.5 GB, 1099511627776 bytes
255 heads, 63 sectors/track, 133674 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xbe84c178

Device Boot       Start         End      Blocks   Id  System
/dev/sde1               1      133674  1073736373+   fd  Linux raid autodetect

Now we will add this disk, to the our array as a spare drive.  If you merely want to add a hot spare drive to your array, you can stop after this next step.  A hot spare is a drive that is automatically used, whenever you have a failure of one of your active drives.


$ sudo mdadm --add /dev/md0 /dev/sde1

Now in this next step we will initiate the process of growing the existing array to include this new drive.  I say initiate, because this is a very lengthy process.  The data on your existing array is rewritten so that it is spread across four drives instead of three.  This will take several hours.  The good news is that your array remains online during this process.  You don’t have to endure any downtime.


$ sudo mdadm --grow /dev/md0 --raid-devices=4

You can monitor the progress with the file /proc/mdstat.  Periodically “cat” the contents of /proc/mdstat and you can see the percentage of progess.  When it has finished, you will have a four disk array, but your mounted file-system will still show its old size.  It will not automatically recognize the additional space.  You to resize your file-system so that it recognizes the additional free space.  Fortunately this step is very fast and takes only a few minutes.


$ sudo resize2fs /dev/md0

When this is done, you can do df -h and see that your file-system now has the additional free space.  What’s cool is you added lots of free space without downing your box all afternoon.

Please don’t forget to update your array configuration file.  Since you now have a four disk array instead of three, you need to let the system know to expect to see four drives instead of three. 

If you forget this step, you array will not mount after you reboot.


$ sudo mdadm --detail --scan | sudo tee  /etc/mdadm.conf
ARRAY  /dev/md0 metadata=0.90 UUID=622146c2:61b0872d:6bbacb7a:b6d31587

That is all.  Enjoy.

Part II: VirtualBox is giving me friction about my AMD-V

This is an update to an earlier post.  In a previous post, I talked about an issue where after upgrading VirtualBox it was no longer able to run 64bit guests, on some motherboards with AMD-V capable cpus.

After digging a little more,  It seems that having the kernel modules kvm and kvm_amd loaded while running VirtualBox was causing the issue.  The presence of those two modules is causing VirtualBox to wrongly see svm as not enabled.

If you are not using kvm and kvm_amd for other things, you can blacklist those two modules to prevent them from loading.  Here is how you do that.  Create a new blacklist .conf file in the /etc/modprobe.d folder.  Then add a line to blacklist those two modules.

$ echo -e  "blacklist kvm\nblacklist kvm_amd" | sudo tee /etc/modprobe.d/blacklist-kvm.conf

Then reboot.

Before starting your guests after the reboot, first you’ll have to recompile your VirtualBox drivers.  You must do that as root.

$ sudo /etc/init.d/vboxdrv  setup
 * Stopping VirtualBox kernel module
 *  done.
 * Removing old VirtualBox netadp kernel module
 *  done.
 * Removing old VirtualBox netflt kernel module
 *  done.
 * Removing old VirtualBox kernel module
 *  done.
 * Recompiling VirtualBox kernel module
 *  done.
 * Starting VirtualBox kernel module
 *  done.

Your 64bit guests should start and run without issue as they were meant to do.   If not then make sure that you didn’t make a typo along the way.  Then verify that the two kvm modules are not loaded.  If you still can’t get it work, remember that the workaround from the previous post still works wells.