May 29, 2012

Simple Bash Script to Reverse Your Name and Output it

Just a quick script to reverse some input, using Bash and the FOSS "rev" program. It's amazing how easy it is to manipulate things with Bash. I love it!


Bash script version:
#!/bin/bash
#Simple script to reverse an input name

echo "Enter your name";read 'myname'


echo "Your name spelled backwards is: $( echo $myname | rev )"

exit 0


One-liner version:
echo -n "what is your name?";read name;echo "$name" |rev


Or how about this more ridiculous example (one that doesn't use the "rev" program):
#!/bin/bash
#Simple script to reverse an input name


  echo -n "Enter your name:"
  read myname

  numChars=$(echo -n "$myname" |wc -c)
  revname=
  while [ $numChars -gt 0 ]
  do

      revname=$revname$(echo -n "$myname"|cut -b$numChars)
      numChars=$(expr $numChars - 1)

 done

echo "Your name spelled backwards is: $revname"

exit 0


Ridiculous one-liner version (one that doesn't use the 'rev' program):
echo -n "Enter your name:";read myname;numChars=$(echo -n "$myname" |wc -c);revname=;while [ $numChars -gt 0 ];do revname=$revname$(echo -n "$myname"|cut -b$numChars);numChars=$(expr $numChars - 1);done;echo "$revname"


May 25, 2012

Simple Bash Script to Remove Clearcase Views (experimental)



So I just wanted to take a minute to say how awesome GNU Bash is, and that you can do a great many things with it. One of those things you can do is run commands from the cross-platform-compatible(mostly) IBM Rational Clearcase cleartool.


Since I was working on cleaning up some old user views, I thought I'd just make a quick writeup on a script for helping with this task. I did it because I like writing scripts in Bash and I'm working (very often) to get better at it. Please note, the script is experimental, and just meant for tinkering purposes. That said, I can't be held responsible for any damage you do to your systems as a result of using this script.

The script takes a parameter of the username. The script will search for views that are owned by the username, and will de-register, de-tag them. As for deleting the actual files at the view path, that part is NOT done by this script. Instead, the script will record the server name and view path into a file named "ViewsToDeleteReport..." for you to sort through for reference to the final removal.

The reason I left the deleting of the files off is two-fold, 1.) It's a bit tricky to remove the files from multiple view servers at once, and 2.) for safety - if you somehow remove the wrong view from clearcase, you can easily go back and re-register the existing view files back as a view again. I certainly hope someone can find something useful here.

 
#!/bin/bash
#Delete clearcase Views (clearcase parts, not physical data parts) Script
#License GPL v2.0 - More information is available at fsf.org
#By: Shannon VanWagner
#05-01-2012
#humans-enabled.com
#TODO - read multiple users based on file input

deleteUserViews()
{
if [ -x /opt/rational/clearcase/bin/cleartool ]
then
  ct=/opt/rational/clearcase/bin/cleartool
  rtimestamp=$(date +%Y_%b_%d_%H_%M-%S)
else
 echo "Fatal Error(31) no cleartool executable at /opt/rational/clearcase/bin/cleartool, script halted"
 exit 31 
fi
 
for item in $($ct lsview -long|egrep -B10 -i "view owner: \/$1|view owner: $1"|grep -i 'tag:'|cut -d" " -f2)
do
  if [ $item ]
  then
    vuid=$($ct lsview -long "$item"|grep -i 'view uuid:'|cut -d" " -f3)
    vpath=$($ct lsview -long "$item"|grep -i 'view server access path:'|cut -d" " -f5)
    vserver=$($ct lsview -long "$item"|grep -i "view on host:"|cut -d" " -f4)

    #Process clearcase view removal 
    echo "Removing clearcase references for view:$item" 
    $ct endview $item > /dev/null 2>&1
    $ct rmview -force -uuid $vuid -all > /dev/null 2>&1
    $ct unregister -view -uuid $vuid > /dev/null 2>&1
    $ct rmtag -view $item > /dev/null 2>&1

    #Call report output for view deletion info
    reportFilesToDelete $rtimestamp $vserver $vpath
  else
    echo "Fatal Error(43) Base cleartool lsview failed, script halted."
    exit 43
  fi
done
}

reportFilesToDelete() {
#Expects timestamp:$1, server:$2, path:$3 

if [ $1 ] && [ $2 ] && [ $3 ]
then 
  rname="$(echo $delViewReportName)_$1.txt"
  echo $2 $3 | tee -a $rname
else
  echo "Missing timestamp, servername, or path from function call"
fi

}

# main
if [ $1 ]
then
  usern=$1
  delViewReportName=ViewsToDeleteReport
  deleteUserViews $usern
else
 progname=$(basename $0)
 echo -e " What user views shall I delete? \n Script Usage: ./$progname username"
 #29 no parameter error code - defined by me
 exit 29
fi

echo "Done"
exit 0


Note: If you're looking for a FOSS solution for your source code repository solution instead. I would recommend you try "git" from http://git-scm.org instead.

Cheers!

Shannon VanWagner
05-24-2012




May 10, 2012

How to install FreeNX on Ubuntu 12.04 Precise Pangolin

Ask anyone who knows me and they will tell you that I am a vocal (and perhaps tireless) advocate of FOSS/GNU/Linux. I loves me some FOSS and GNU/Linux and I really like to help others with it as well!

So after writing my post: How to install NX Free Edition on Ubuntu 12.04 Precise Pangolin, I will follow it up with a story about FOSS. In this post, I will guide you through some easy instructions for installing the GPL,FOSS NX server variant called FreeNX, and the FOSS "qtnx" client that is used to connect to the FreeNX server.

The main difference is that, unlike NX Free Edition, which is licensed as proprietary ( 2 connections limit), FreeNX and qtnx are completely Free Open Source Software (FOSS, GPL)! Sounds good right? It's music to my ears. Afterall, this FOSS/GNU/Linux stuff makes the Technical world go around for everyone.

So here are the simple instructions (and a couple of tweaks) that I used to get this all working:

First, you need to add the freenx-team PPA for Ubuntu 12.04 GNU/Linux. Hit CTRL + ALT + t to get your Terminal, then type or paste in the command below, then hit Enter, then hit Enter to confirm the addition of the new source:
sudo add-apt-repository ppa:freenx-team
Next, update your sources list, then install the FreeNX server software (there are two commands below, the 2nd only runs if 1st is successful). After verifying that no important packages will be removed, hit Y then enter to install FreeNX server:

sudo apt-get update && sudo apt-get install freenx

Next, as noted in the community documentation for installing FreeNX - download the missing nxsetup script, untar it, then copy it to /usr/lib/nx (the command below is one entire line that runs 3 commands and ends with /usr/lib/nx):
wget https://bugs.launchpad.net/freenx-server/+bug/576359/+attachment/1378450/+files/nxsetup.tar.gz && tar xvf nxsetup.tar.gz && sudo cp nxsetup /usr/lib/nx
Now, run the nxserver setup script. I chose to use the default NoMachine provided encryption keys during this command to save on client configuration steps (hit N for No at the to do this):
sudo /usr/lib/nx/nxsetup --install
At this point, you have FreeNX server installed, but now you'll want to configure the FreeNX server to configure clients to use ubuntu-2d session:
echo -e "\n#Use unity 2d for client sessions\nCOMMAND_START_GNOME='gnome-session --session=ubuntu-2d'"|sudo tee -a /etc/nxserver/node.conf


Next, restart the FreeNX server to ensure it takes in the .conf file:
sudo /etc/init.d/freenx-server restart
That's it for the FreeNX server, now let's move on to the client. First, install the 'qtnx' package on Ubuntu 12.04 so we can have a client application to access the FreeNX server. You'll have to launch the Ubuntu Software Center, then click 'Edit > Software Sources' from the top menu. Then place a check by "Community-maintained free and open-source software (universe). Also, uncheck "Cdrom with Ubuntu 12.04" if it's checked. Then close the Software Sources dialog and the Ubuntu Software Center.
Now, run the commands to update your sources and install the qtnx application from the terminal (CTRL + ALT + t):
sudo apt-get update && sudo apt-get install qtnx
Ok, from the Unity menu or the CLI, start the 'qtnx' application. Enter the username/password for a user on the server, set the speed to LAN, then click configure. On the configuration dialog, set a name for the prfile, the hostname(or IP address) for the FreeNX server machine, the client resolution (I used 1024x768), network speed (LAN), and set the platform type to GNOME (see the example screenshot below).


Note: For the non-GNU/Linux clients, you can use nomachine.com's NX Client Free to connect to the server. Just use GNOME as the session.

That's it! Get your FreeNX connection on!

As for the version I tested with, it's: nxserver --version 3.2.0-74-SVN OS (GPL, using backend: 3.5.0)

Extra Tip: If for some reason your client wouldn't connect after testing, try deleting the entries in the ~/.nx directory. I'm not sure why this would help at all in most cases but it seemed to work for me.

Additional resources from and Credit to:

Cheers!

Shannon VanWagner
05-10-2012




Apr 30, 2012

Easy 'mail by smarthost' SMTP server in Ubuntu 12.04 GNU/Linux

After being tasked with setting up some servers that need to use a local MTA (Mail Transfer Agent) (via SMTP) on our internal network, I found the setup for the Ubuntu 12.04 GNU/Linux exim4 MTA to be pleasingly simple. Easy Peasy, works for me!

Assuming you already have a main mail server in your organization that you can use as a "smarthost" relay, run through these simple steps and you will be up and running with a local SMTP server on your Ubuntu GNU/Linux box in no time.


1.) Install the MTA package on your Ubuntu 12.04 GNU/Linux box:

sudo apt-get install exim4-daemon-light

2.) Configure the MTA with this command and steps, replacing somedomain.com with your mail domain name:

sudo dpkg-reconfigure exim4-config

  • Set postmaster email: postmaster@somedomain.com
  • Select 'mail sent by smarthost; no local mail'
  • Set somedomain.com at the "System mail name" screen
  • Set defaults(hit enter) until you get to the step below
  • Enter mail.somedomain.com for the "IP address or host name of the outgoing smarthost:"
  • Set defaults all the way to the finish

That's it! exim4 should restart and you'll be ready to test. Now wasn't that easy?

Now check if the smtp server is listening on port 25 (smtp) with these terminal commands:

netstat -ano |grep :25

Should see something like:
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN off (0.00/0/0)

Test the setup by sending an email to yourself from the Terminal:

echo "Yay - SMTP works" | mail -s "Test email" youremail@somedomain.com

That's it! Now you're free to go and get the beverage of your choice and drink to the awesomeness of the makers of FOSS/GNU/Linux/Ubuntu.

Cheers!

Shannon VanWagner
04-30-2012



Apr 25, 2012

How to install NX Free Edition on Ubuntu 12.04 Precise Pangolin

Screenshot of NX client connection to Ubuntu 12.04 with NX Free
Ubuntu GNU/Linux comes pre-loaded with the capability to remotely connect to the graphical desktop of your machine by means of a "Desktop Sharing" utility based on the VNC protocol. Clients can connect with a VNC viewer, i.e., tightvnc, vncviewer, etc.

While this may be a viable option for others, VNC has a few drawbacks that sent me looking for something a little more suited for my situation. Namely, I needed a speedy connection, and security.

One problem with VNC is that it's a non-encrypted and therefore non-secure protocol. The workaround for this is to configure the server to tunnel VNC client connections through SSH sessions. Unfortunately, doing this requires extra configuration on both the server and the client.

Another problem with VNC (at least one that I've experienced) is the laggy connections, which can make the user experience less than optimal. So in my search for a better alternative, I found "NX Free Edition" by www.nomachine.com.
 
NX Free Server delivers the X Window session to clients via the encrypted SSH (Secure Shell) protocol, and it does it much faster and snappier than my experience with VNC. The only drawback of NX Free Edition is the license, as it is proprietary..

Although "NX Free" edition is said to be "free forever". Looking at the license file in the .deb package, it appears there are a number of GPL-covered items there, and then some items with the proprietary license. Checkout the license for NX Free for yourself here.

On the subject of NX servers, there is a FreeNX server PPA for Ubuntu 12.04(and other LTS versions), it's named ppa:freenx-team . Unfortunately, at the time of this writing, the packages from the ppa:freenx-team didn't seem to work properly for me. There was some error message concerning the esound dependency package not being available for install.

So, instead of FreeNX, we'll install NX Free Edition with the provided .deb installers instead. I used the 64-bit versions in my tests. Apparently, the big difference between 'FreeNX' and 'NX Free Edition' is that FreeNX is wholly FOSS and has no connection limits whereas the NX Free Edition is only partially FOSS and is limited to 2 client connections (according to the license page at the link above).

Before installing the NX Free Edition pacakages from: www.nomachine.com, first install the openssh-server package from the Ubuntu repositories.

sudo apt-get install openssh-server

After the pre-requisite has been installed, download and install the 3 NX Free Edition components from the "NX Free Edition for Linux" section at www.nomachine.com ( packages are installed in this order: client / node / server). Example:
sudo dpkg -i nxclient_3.5.0-7_amd64.deb
sudo dpkg -i nxnode_3.5.0-7_amd64.deb
sudo dpkg -i nxserver_3.5.0-9_amd64.deb

As for the connection to the NX Free Edition server, simply download the client from www.nomachine.com that works with your platform. There are versions for all 3 of the Major operating systems available.

As of this writing, the regular Ubuntu session provided by NX Free server doesn't quite work as expected . Not to worry, the 'ubuntu-2d' session does work well. I'm working on getting the appropriate server-side configuration for this so the setting won't be required at the client, but in the mean time, the workaround is to configure the NX Free client Session setting as follows:
Application > "Run the following command": gnome-session --session=ubuntu-2d

Options > Enable 'New virtual desktop'


That's it. NX Free Edition works great and it's one solution to the problem of needing more security and speed over the default VNC client in Ubuntu GNU/Linux. Here's a screenshot of the client connection.



Feel free to leave your comments below. If you are using Ubuntu 11.10 and are having problems with Unity at the client, see this link for the workaround. For more information concerning FreeNX on Ubuntu, see this link.



Looking for the FreeNX Server installation instructions? See my post "How to install FreeNX on Ubuntu 12.04 Precise Pangolin" instead. Cheers!

Shannon VanWagner
04-25-2012




Apr 5, 2012

On Helping Others Get their GNU/Linux & Consider Doing So

So one day I'm looking at my Google + page and I get this notification of a message:

"Can you help me to configure chip ralink rt2870 on Ubuntu(GNU/Linux), please?"

I really can't imagine at all, I mean I am absolutely dumbfounded as to why this person would contact me.. Really, it's not like I post (on average) 5 stories about GNU/Linux a day or anything... haha..

Turns out the driver this person needed was one of the types where it hadn't made it into the Linux kernel just yet, but the source code was out there. And so a module had to be built from source and installed on the machine to make the wireless adapter work.

Usually these types of problems are relatively easy to get fixed, because: a.) GNU/Linux is open source and so bugs can get fixed (or worked around) by anyone with the technical know-how, and b.) there are kind people out there that take their own time to post the specific step-by-step instructions to repair the problems. However, sometimes finding the correct "fix" to match your specific hardware configuration can be tricky. GNU/Linux has a great many tools to detect what type of hardware is in the machine, but(luckily) there are many different types of hardware out there.

Aside from finding a fix that applies to your specific hardware, another problem (and this can apply to any OS), is that  you can get into these situations where, if you don't cleanly de-install previous attempts at a fix that you have made, the residual clutter can mess things up for anything new that you're trying to install. When this happens, a crucial ingredient to success can sometimes be lost. That is, the "faith" in a person that they actually can fix the problem in the first place.

So, as it turns out, this person needed to remove the older (and incorrect version) driver that he had installed ( sudo make uninstall from within the source folder ), then start fresh, rebuilding the driver from the correct source, installing the driver, and configuring things correctly for use. I'm fairly certain this person could have knocked this out, had they de-installed the incorrect version they had on their machine and taken a few more steps.


So I respond:

"Which rt2870? Is it the USB stick? Also, which Ubuntu, is it 10.04? If both true then according to this article, you need to blacklist a module, along with a few other seemingly ugly things: http://linuxforums.org.uk/index.php?topic=852.0 (Thanks to: Mark Greaves for posting there ) and http://ubuntuforums.org/showthread.php?t=960642 (Thanks to: Nilsa5 for posting there). But, we'd want to see exactly what you have in terms of wireless adapter and version of Ubuntu before we jump in. You can see the version of Ubuntu with the terminal command 'cat /etc/issue', and the kernel with 'uname -r' or 'uname -a' to show whether you have 32bit or 64bit, and if you have a built-in wireless adapter 'sudo lspci |grep -i network' or USB adapter 'sudo lsusb |grep -i network'. Also, you could see which module is loaded with 'sudo lsmod | grep rt2870sta' or 'sudo lsmod | grep rt2800usb'."

And after some back and forth, I figured we could save time if I were just to connect to this person's machine and help him fix the problem directly. This is another place where the free stuff comes in, this time it's teamviewer.com (Teamviewer is one of those cross-platform-compatible applications where I could control the remote computer and they could see what I am doing at the same time). There are definitely FOSS alternatives to this, like VNC server/client (some setup required), or we could have used Google Chrome Remote Desktop instead of course. But to me, the main thing is that I only use tools that are cross-platform-compatible(this is a must), and in this case, free of charge.


How awesome is it that there are FOSS/GNU/Linux supporting individuals and and companies out there that continue to help to make GNU/Linux better for all of us? Very awesome indeed I say. And also how great is it that some other FOSS-supporting companies (and a few Freeware ones too ) are outright handing us all the tools we need to provide one another support for Technical issues for Free?! Fabulous! How cool is that? So by helping this person get their wireless up and running, that's how I contribute to GNU/Linux/FOSS myself. This brings me great satisfaction, not only as a technologist, but it's also a great feeling to be able to help someone else free themselves from the dungeons of the coercive monopolists and their restrictive software.

So anyway, when I get connected to this person's computer, I am a bit surprised that my left click on the mouse was reversed to the right click! And the person apparently had the language setup for something totally different than mine. Talk about adding a layer of difficulty! What a nice delicious challenge! So then I bring up the gedit on his machine and type to him a message, and it's in this foreign language.. So I'm thinking, that's not going to work.. so then I open his web browser and navigate to google.com/translate (another awesome FREE tool), and we proceeded to use that to communicate, right there on his computer, for the rest of the time.

So, working at the command line, I'm already knowing what commands to use, and so I'm cranking away, de-installing the older driver, checking to ensure dependencies are installed, compiling the new driver, installing the new driver. Then, after some rmmod, insmod, and reboot between.. voila! The driver is finally working! The person, having watched how easy it was, and now seeing that his wireless was working perfectly, was elated and Thanked me profusely. This is a very delightful aspect of FOSS in my eyes, to be helping others and not having to call into some paid-for "support case" because the proprietary OSes come with no warranty.

Recapping it all, the point I wanted to make is how very proud that I was to be able to help a fellow human being with their GNU/Linux. If you have tried GNU/Linux, and have figured out something worth sharing, I suggest you do as well. But you don't have to be a technical person to do good things for FOSS/GNU/Linux. Nope. You can help by simply telling others your stories. Post them on your blog, mention them in comments, correct those nay-sayers, yell it from rooftops! Also, I want to say that I am grateful for FOSS/GNU/Linux, all the people that make those possible, and also for the free tools like Google+, Google Translate, Teamviewer, etc. (the list is exhaustive). Helping others (and ourselves) is the spirit of Technology! Don't let some profiteering, coercive monopolist change your mode of thinking.



Cheers!
Shannon VanWagner
04/05/2012

FREE YOURSELF, Use GNU+LINUX+FOSS! gnu.org | fsf.org | linux.com | getgnulinux.org | ubuntuguide.org | whylinuxisbetter.net | documentfoundation.org | humans-enabled.com | ubuntu.com | distrowatch.com | makethemove.net | livecdlist.com | code.google.com/opensource | sourceforge.net



Mar 19, 2012

How to Fix Ubuntu 12.04(beta) boot problem for Sony VAIO VPCZ114GX

Update 3/29/12 - Get the script to set this up automatically here (sha1sum: 8b8c5c6d08ea5cbc8c925d5a2f29420ae1c2986e) .

My willingness to try out the "beta" versions of FOSS/GNU/Linux software is only exceeded by my sense of adventure for fixing any computer startup problems that may result from installing those "bleeding edge" updates.

GNU/Linux is famous for being a "rock solid" operating system, but if you're trying out the "beta" versions, you shouldn't be surprised if you find yourself having to "roll up your sleeves" to get the system fixed.. or at least reverting back to the previous version to get around a bug. For me, I actually like "rolling up my sleeves" for GNU/Linux. Especially because I know a.) I will learn something new, and b.) I might get a chance to help others overcome a similar problem by speaking out about my findings.

Recently I upgraded my Sony VAIO VPCZ114GX to Ubuntu 12.04 GNU/Linux BETA version.. Having booted up to the Ubuntu 12.04 LiveCD, everything was running great, so I went ahead with the clean install on my separate root ( / ) partition.

But, after rebooting, instead of seeing my shiny new Ubuntu 12.04 BETA desktop - I was instead presented with the not-clickity-friendly "busybox" instead (see image below).  So here I was, stuck in initramfs.



One thing I really like about GNU/Linux, and particularly the more active distributions like Ubuntu, is that where there's a problem - there's usually a bug report already filed and either a fix in the works, or at least a workaround available.

Sure enough, after looking around (and with some clues from the "Sony VAIO Z series" Team on launchpad.net ) I found the Ubuntu Launchpad bug report related to this issue, entitled: " (fakeraid) root device not activated during boot ".


The great thing about having the bug reported is that usually the experts will come in and leave comments for what the workarounds to the problem are. I found just that at the bug posting.

Turns out, during the initial boot process with the initrd.img-3.2.0.18-generic, the "fakeraid" for this particular Sony VAIO doesn't get all the way setup and so the system fails to find the root ( / ) partition (think c:\ for windblows).  So instead of giving you any type of "blue", "grey" or other kind of "death" screen, instead the GNU/Linux system does something more useful. Upon failure to mount the root partition, the system reverts to the interactive "busybox" environment. The busybox provides you with a basic way to interact with the system with various commands and tools for troubleshooting.


Anyways, so from the busybox environment, you can finish the activation for the software RAID on the Sony VAIO VPCZ114GX by hand. Simply use the command below (also pictured below) (Thanks to Wouter van Der Graaf here ) .
dmraid -ay 



So now I was able to get my system booting. Right on. I Love this stuff!


Of course, one of the great things about GNU/Linux/FOSS is that it's open source. So anytime you feel like trying to figure out a problem for yourself, feel free! It's fully legal (and realitively easy because it's open source) for you to open up and look at files that make things work, and even fix them. And then, you can even legally share the fixed software with others if you want! What a great concept.

Feeling a bit adventerous, I set out to try to figure out why the system wasn't able to boot. Since the system boots using open source scripts, you can extract the initrd.img and troubleshoot the scripts that bootup the system. I'll lay out the steps I used to create a temporary fix for the problem below.

I actually went back and installed Ubuntu 11.10, so I could save the initrd.img-3.0.0-12-generic files to compare against the Ubuntu 12.04 initrd.img-3.2.0-18-generic files. Using the 'diff -r' command, I was able to find one simple difference between the sbin/dmraid-activate script in the Ubuntu 11.10 initrd.img version and the newer one. The 'dmraid -i -ay $1' command at line 75 was changed to 'dmraid -p -i -ay $1'. So when I removed the -p from that script, the system is now able to boot. The Ubuntu devs posted comments on the bug report that said the -p is supposed to now be there.. but there's a bug being worked and removing it lets the system boot properly while we await a real fix for the problem.

NOTICE! This is not an official fix! It's just a workaround that works for me. Also, initrd.img-3.2.0-18-generic will be replaced as it is updated. Eventually, the Ubuntu developers will fix the problem and then I'll get a system update, and it will be fixed. I just wanted to make this post so others may see how I fixed the problem for my Sony VAIO VPCZ114GX. Obviously, I cannot take any responsibility for anything you do to your own system, even if you do decide to use the instructions here.

So in order to change the original initrd.img.3.2.0-18-generic startup image, I extracted it into a directory, changed the dmraid-activate script(mentioned above), then repacakaged the initrd.img.3.2.0-18-generic for booting my computer.

Here are the steps I used to make this happen:

# Become root
sudo -s
# Make a backup copy of your current initrd.img-3.2.0-18-generic file:
cp /boot/initrd.img.3.2.0-18-generic /boot/initrd.img.3.2.0-18-generic.original
# Switch directory to your home (e.g., /home/shannon )
cd ~
# Copy the broken initrd.img.3.2.0-18-generic file to the current directory
cp /boot/initrd.img.3.2.0-18-generic .
# Make the new directory for extracted contents
mkdir initrd.img-3.2.0-18-generic_FILES
# change directories into the directory you created
cd initrd.img-3.0.0-12-generic_FILES
# Extract the contents of initrd.img-3.2.0-18-generic into the current directory
# This command is split into 2 lines. Second line is created by the "\" character 
 
gunzip -c -9 ../initrd.img-3.2.0-18-generic | \
cpio -i -d -H newc --no-absolute-filenames

At this point, I made a simple change to the extracted sbin/dmraid-activate script with vi:

vi sbin/dmraid-activate
/dmraid -p #hit Enter. This will find the txt "dmraid -p" in the file
Y # Type it (capitalized).. Y copies the line
P # Type it (capitalized).. P pastes the line
i # Type it.. for insert mode
Type "#" - (no quotes) #This will "comment out" the duplicate line
Hit the ESC key to exit insert mode
# Then, use the arrow keys to move your cursor to -p on the uncommented line
Type "3x" #This will delete the three characters "-p "
# You should end up with this:
        #dmraid -p -i -ay -Z "$1"
        dmraid -i -ay -Z "$1"
# If you think you made mistakes that affect multiple lines, 
# you can cancel your edits and quit by typing ":!q" (no quotes), then hit Enter 
ZZ # Type it.. this will save and close the file


With the edits out of the way, now it's time to repackage the initrd.img-3.2.0-18-generic file and copy it into your /boot directory so it can be used to start the computer. Here are the steps (assumes you are still root in your terminal):

# Run this from inside the initrd.img-3.2.0-18-generic_FILES directory (from above)
find . | cpio --create --format='newc' > ../initrdimg
cd ..
mv initrdimg initrd.img-3.2.0-18-genericmodded
gzip initrd.img-3.2.0-18-genericmodded 
mv initrd.img-3.2.0-18-genericmodded.gz initrd.img-3.2.0-18-genericmodded
# Caution: this commandd will overwrite your current initrd.img.3.2.0-18-generic,
# make sure you have backed it up as noted above
# (if you deleted it by accident, simply run 'sudo update-initramfs -u' (no quotes))
cp initrd.img-3.2.0-18-genericmodded /boot/initrd.img.3.2.0-18-generic
# Now make a backup copy of your modified file at /boot/initrd.img.3.2.0-18-genericmodded,
# so you can key it in if an update replaced your /boot/initrd.img.3.2.0-18-generic
cp initrd.img-3.2.0-18-genericmodded /boot/initrd.img.3.2.0-18-genericmodded
# If a system update knocks out this hack:
# To get to the grub screen, hold the Left SHIFT key on startup, 
# then hit "e" to edit the boot command
# replace /boot/initrd.img.3.2.0-18-genericmodded on the initrd line

That's it! Exit out of the terminal and reboot your machine. It should boot right past the busybox now.

Remember, the purpose of this post is to document what I learned about working with the initrd.img file. I don't intend for the steps in this post to be a permanent fix in any way. I've subscribed to the bug report above, so I'll see happens in terms of a fix. The bug is marked as importance:high - so that makes it all the more exciting to me.

Feel free to leave a constructive comment or question below, if you like.

Cheers!
Shannon VanWagner
03-19-12




Dec 18, 2011

How To: Fix Samsung Galaxy Nexus MTP File Transfer for Ubuntu GNU/Linux 11.10

So I've been so lucky as to have a spankin' new Samsung Galaxy Nexus phone with Android Linux "Ice Cream Sandwich" version from Verizon bestowed upon me! Yeah!

I have to tell you, I am thoroughly enjoying this phone! I'm loving it! I really like the big screen, the great on-screen keyboard, the snazzy new Ice Cream interface, and most of all the 4G Internet speed.

There was only one little surprise for me with this new phone: Having to use the Media Transfer Protocol "MTP" ( ms ft technology), and/or the Photo Transfer Protocol "PTP" to transfer files to/from the device instead of USB Block mode. Both of my previous phones, the Moto Droid and then the Droid Incredible, used USB block mode instead.

The way USB block mode works is that when you plug the device into the USB port with the cable it is simply detected as an external USB drive. This is nice because no additional applications or proprietary frameworks are needed to access the drive.

With the Samsung Galaxy Nexus however,  you have to install some additional software so you can mount the device using "MTP" Media Transfer Protocol. I think it would be nice if you had the choice of using whichever one you want.

MTP works with GNU/Linux, but it requires the installation of some extra applications to get connected to the device. One such application is called gMTP by Darran Kartaschew (aka Chewy509).


The gMTP program is a graphical utility that lets you add/delete/copy/make folders/etc. to your device via MTP. gMTP is available in the Ubuntu Software Center.

The only problem I had with gMTP, which depends upon libmtp from sourceforge.com, is that the latest libmtp hadn't been updated on my Ubuntu (11.10) yet. So, since I had the older libmtp, I was experiencing a bug where trying to copy files onto my Samsung Galaxy Nexus wasn't working properly. At least one other person was having this problem, according to this post on sourceforge.com.  To make a long story short, I posted my complaint on G+ and then magically.. +Paul Eubanks suggested that I should check into installing the newer libmtp to fix the problem. This hit the nail on the head! Thanks Paul!
 
Eventually, probably within a few weeks or months, libmtp will be updated for Ubuntu, and then you won't experience the bug I did.. But until then, here are the instructions for installing the newer libmtp, after compiling it from source.

Step 1. Install the libusb-dev dependency package so you can build libmtp
sudo apt-get install libusb-dev
Step 2. Download the latest libmtp tar.gz from here:
http://sourceforge.net/projects/libmtp/files/libmtp/

Step 3. cd into the same directory where you downloaded the new libmtp*.tar.gz and extract the tar package:
tar xvf libmtp-1.1.1.tar.gz
Step 4. cd into the libmtp directory you just extracted , then compile and install using configure/make/make install:
cd libmtp-1.1.1/
./configure --prefix=/usr
make
sudo make install
Step 5 (maybe optional). Not sure if I needed this step or not, but if everything in the last step went well, you'll now have the 69-libmtp.rules file in the current directory, and you can copy it to /etc/udev/rules.d to ensure you can access the phone through the USB.
sudo cp 69-libmtp.rules /etc/udev/rules.d
Step 6. Install the handy gMTP Graphical MTP file access utility:
sudo apt-get install gmtp
Step 7. Try to run gMTP and see if it connects to your device. If not, then refresh things by unplugging your phone, rebooting the computer, then plugging in your phone again. Then, try to launch gMTP from the Unity/Gnome menu again, see below.




Step 8. You should see something like below when you click connect. Also you should be able to copy files to and from the device with ease.



If you want to check to ensure your computer has the newer libmtp, run this command:
ls -lah /usr/lib/libmtp*
You should see something like below.. notice the libmtp.so.9.0.1 and file date there
svanwagner@ubuntu-scythe:/usr/lib$ ls -lah libmtp.* -rw-r--r-- 1 root root 725K 2011-12-18 01:12 libmtp.a -rwxr-xr-x 1 root root 921 2011-12-18 01:12 libmtp.la lrwxrwxrwx 1 root root 15 2011-12-18 01:12 libmtp.so -> libmtp.so.9.0.1 lrwxrwxrwx 1 root root 15 2011-12-18 01:12 libmtp.so.9 -> libmtp.so.9.0.1 -rw-r--r-- 1 root root 256K 2011-08-09 06:10 libmtp.so.9.0.0 -rwxr-xr-x 1 root root 611K 2011-12-18 01:12 libmtp.so.9.0.1
Here's an extra tip: The gMTP program version 1.2.0 has the root of the filesystem "/" set for the "Download" control (by default). So if you launch the program normally, when you select a file and click "Download", you'll get an error because the program will have tried to save the file to "/", which unless you run your computer as root - is not writable by regular users. To fix this problem, you should open Edit > Preferences for gMTP, then place a checkmark by "Always show Download Path", as shown in the picture below. With this setting enabled, you'll be prompted for a location to store the file when clicking "Download", and you can pick something like Desktop or your Documents folder so you can get your files.



That's it! Now you can move files on and off your Samsung Galaxy Nexus device with ease!

Update: pointed out how the libmtp update does not help the problem with connecting  the Nexus to Banshee or even Rhythmbox.

To have Banshee see your Samsung Galaxy Nexus (Android):
  • Close out of banshee completely
  • Plug in your phone and open the root folder (select open folder on plug-in prompt)
  • Create an empty file, rename it to ".is_audio_player" (no quotes)
  • Open the Banshee Music player and it will see your device
To have Rhythmbox see your Samsung Galaxy Nexus (Android):
  • Simply enable Debugging Mode on the Phone, then attach it to the computer
Credit:
http://www.omgubuntu.co.uk/2011/01/banshee-doesnt-show-android-fix/
https://bugs.launchpad.net/ubuntu/+source/banshee/+bug/896376

Want to try a different way? See here: http://www.omgubuntu.co.uk/2011/12/how-to-easily-mount-the-galaxy-nexus-on-ubuntu-11-10-via-unity/

If you'd like to leave a comment, please do so below.


Cheers!
Shannon VanWagner
12-18-11
 




Dec 14, 2011

How To: Cisco Systems VPN with Ubuntu 11.10 / 10.10 GNU/Linux

What you'll need:
  • gateway DNS name or IP address for the VPN
  • username/password for access to the VPN server
  • group name/password for the VPN settings
  • Special Note - these instructions are for connecting to the VPN using the Cisco Systems VPN client. If you are looking for instructions related to using the open source alternative to the Cisco AnyConnect client (openconnect), have a look at my post entitled: How To Connect Ubuntu Linux to Cisco VPN with openconnect (anyconnect-capable alternative)
First, install these packages to extend the functionality of the graphical network manager in Ubuntu:
sudo apt-get install vpnc network-manager-vpnc


At this point you can try restarting your session (ctrl-alt-backspace if you have it configured via keyboard>Layout Settings>Options>Key Sequence to kill the X server), but it may take a full reboot of the computer for the settings to take effect.

Now, open the network manager, hover over VPN Connections, then click Configure VPN..., then click Add, select "Cisco Compatible VPN (vpnc)".




Enter your username, groupname, group password (set the dropdown to save the group password if it is very long ).

Ubuntu 11.10 Example:


 Ubuntu 10.10 Example:


Click Apply to save the connection settings. To connect, simply click the Network Manager icon in your panel, hover over VPN connections, click your connection, then enter your VPN password when prompted. Easy, peasy.. That's it!



Related Tip: To convert your *.pcf vpn client profiles to vpnc format, try the instructions here:  http://baheyeldin.com/cisco/converting-cisco-easy-vpn-pcf-files-linux-vpnc-configuration-format.html



Shannon VanWagner
14 December 2011

Dec 12, 2011

How to install Bugzilla with HTTPS on Ubuntu 10.04.3 LTS Server


So after a quick search, I couldn't find any one site with specific instructions on how to install Bugzilla 4.0.2 on the Ubuntu 10.04.3 LTS GNU/Linux server.

Since I spent some time and worked out the problems myself, I thought I'd post what worked for me. If you have any suggestions to make this writeup more accurate, or more secure, please leave a comment below with your wisdom. Thanks!


Things that you might need:
  • hostname for the server
  • username password for the bugzilla server
  • ip address to use for the bugzilla server (static is suggested)
  • root password for your mysql
  • password for your self-signed SSL cert
  • password for the bugs user
  • email address / name / password for the admin user
First, install Ubuntu 10.04.3 LTS Server version. There is nothing special about this step besides I recommend you use a strong password for the user you create and perhaps you can select 'Install security updates automatically' at the manage upgrades prompt. Also, don't select 'LAMP server' during the software installation step as we'll put in just the specific packages we need in the steps below. Although, if you want to remotely manage your server using ssh, do choose OpenSSH server to install (I'll put in some instructions for disabling root login to ssh later**). Once your Ubuntu Server is installed and ruuning, login and switch to root. From here on out, you'll perform the installation steps as root. To become root:
sudo -s
Run updates for the box. This will get you setup for the next step of installing packages.
apt-get update && apt-get upgrade -y
Note: this step may require a reboot to fully complete the update if the kernel was updated. Tip: At this point, if you're setting up your server in a virtual machine this is a good place to make a baseline snapshot so you can revert to it later if things go all wrong. I used Oracle's Virtualbox, the Open Source version. I installed Virtualbox with the terminal command: sudo apt-get install virtualbox-ose If you have a specific (static) IP address for the bugzilla server, set it up on the box with this:
vi /etc/network/interfaces
Then comment out this line by putting # in front like this:
#iface eth0 inet dhcp
Then add these lines (apply specific values for your environment):
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
Then reset the networking on your server with the command
/etc/init.d/networking restart
Now we'll install the baseline packages for the bugzilla webserver using apt-get:
apt-get install libnet-ssleay-perl apache2 libapache2-mod-perl2 libapache2-mod-auth-mysql mysql-server mailutils gcc mysql-server libappconfig-perl libdate-calc-perl libtemplate-perl libmime-perl build-essential libdatetime-timezone-perl libdatetime-perl libemail-send-perl libemail-mime-perl libemail-mime-modifier-perl libdbi-perl libdbd-mysql-perl libcgi-pm-perl -y
Note: Set the password for your mysql-server root user during the setup of mysql during installation. Also, by installing the packages above, you will also get the ssl-cert package, which will automatically generate a self-signed cert for your https server. At this point you should be able to open http on your website. e.g., http://192.168.1.100 (per the example configuration above) should show a page that says "It works!". Very simple eh? Now we need to enable ssl in Apache2 by running this simple command:
a2enmod ssl
Now, since we'll be using HTTPS for the site, we need to link the default-ssl website profile in the /etc/apache2/sites-available to the /etc/apache2/sites-available using the a2ensite command:
a2ensite default-ssl
This is basically the same as running the command: ln -s /etc/apache2/sites-available/default-ssl /etc/apache2/sites-enabled/default-ssl Now restart the apache2 to refresh the running apache2 server configuration:
service apache2 restart
At this point you should be able to open http on your website. e.g., https://192.168.1.100 (per the example configuration above) should show a page that says "It works!". Note: By default the "snake-oil" self-signed cert is being used from the ssl-cert package for your https capability. If you don't have a remote machine to test access with, use this command from the server itself to test connectivity.
telnet localhost 443
Note:You should see something like below (notice it says connected to localhost):
Trying ::1...
Trying 127.0.0.1
Connected to localhost
Escape character is '^]'.
So now that we have Apache up and running, let's configure our http page to automatically redirect the user to https (this uses mod_rewrite), and then enable CGI for the bugzilla. Enable mod_rewrite - so we can redirect http to https
a2enmod rewrite
Now modify the http configuration file at /etc/apache2/sites-enabled/000-default for redirect to https. Simply add the redirect to HTTPS lines noted in /var/www section as shown below:
vi /etc/apache2/sites-enabled/000-default
<Directory /var/www>
 #Enable redirect to HTTPS - added 3 lines below
 RewriteEngine On
 RewriteCond %{HTTPS} off
 RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from none
</Directory>
Now, since we are modifying the apache2 configuration, let's modify /etc/apache2/sites-enabled/000-default-ssl to enable CGI script capability for the bugzilla website. See below.
vi /etc/apache2/sites-enabled/000-default-ssl
<Directory /var/www>
 Options +ExecCGI Indexes FollowSymLinks MultiViews
 AddHandler cgi-script cgi pl
 AllowOverride Limit
 DirectoryIndex index.cgi
 Order allow,deny
 allow from all
</Directory>
Then restart apache2 with
service apache2 restart
Now let's harden mysql and do some other database admin stuff. Run the command
mysql_secure_installation
Be sure to remove the guest user, disable remote access, and remove the test database. Then, create the database for bugzilla:
mysql -u root -p
Note: Your mysql root password will be required at this point.
mysql>CREATE DATABASE bugs;
GRANT ALL ON bugs.*
TO bugs@localhost IDENTIFIED BY 'bugs';

mysql>quit
Now let's make some needed additional configuration points for mysql:
vi /etc/my.cnf and add:
[mysqld]
# Allow packets up to 4MB
max_allowed_packet=4M
# Allow small words in full-text indexes
ft_min_word_len=2
Ok, restart mysql to load the my.cnf changes:
service mysql restart
Now download/install bugzilla. Download the bugzilla package:
wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.0.2.tar.gz
Extract it:
tar xvf bugzilla-4.0.2.tar.gz
Move it (and hidden files) to the /var/www directory:
mv bugzilla-4.0.2/* bugzilla-4.0.2/.??* /var/www
Set ownership of /var/www to the www-data (apache2) user/group
chown -R root:www-data /var/www
chown -R root:www-data /var/www/.??*
cd /var/www 
Now enable perl modules for bugzilla
perl -MCPAN -e install
Or you can use this (much longer) method:
/usr/bin/perl install-module.pl --all
Check to ensure modules are enabled for bugzilla - some will show as not loaded.
./checksetup.pl --check-modules
Now run the setup for bugzilla, for the first time, to create the localconf file in the /var/www directory
.checksetup.pl
Now make some changes to /var/www/localconfig for bugzilla: Enter a password for $db_pass in /var/www/localconfig Ensure $db_driver in /var/www/localconfig shows mysql Ensure $webservergroup shows www-data (this is the Ubuntu group for apache2) Now Configure mysql for bugzilla use: Login to mysql with your root password - mysql -u root -p Set the permissions for the bugs user
mysql> GRANT SELECT, INSERT,
       UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES,
       CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.*
       TO bugs@localhost IDENTIFIED BY '$db_pass';
mysql> FLUSH PRIVILEGES;
Set the password for the bugs user:
mysql> SET PASSWORD FOR 'bugs'@'localhost' = PASSWORD(' some password');
mysql> FLUSH PRIVILEGES;
mysql>quit
At this point you should move or delete the index.html in the /var/www so that bugzilla doesn't complain about it. I chose to move it.
mv /var/www/index.html ~
Now run the setup for bugzilla for the second time and it should add a bunch of tables and prompt you for the admin-email/password/name.
.checksetup.pl
Now bugzilla should be up and running. Test it out in your web browser. If you need to reset your admin password for bugzilla, do so with:
./checksetup.pl --reset-password=user@domain
If you need to create an admin user for bugzilla, do so with:
./checksetup.pl --reset-password=user@domain
Finally, to setup email for your bugzilla, run this command:
dpkg-reconfigure exim4-config
Select OK to continue, then follow the prompts and make the selections for the way you would like to have your bugzilla server email you. **To disable root login for your bugzilla OpenSSH server (so you have to login as a regular user, then sudo -s for root), simply set 'PermitRootLogin no' in /etc/ssh/sshd_config and then restart the ssh server with service ssh restart. That's it! Hope this helps someone. Shannon VanWagner 12 December 2011
You can test email functionality from the server with:
echo "This is a test" | mail -s "Test email" working-email-addr@your-valid-domain.com
If email is not working, try this diagnostic test:
exim -bt working-email-addr@your-valid-domain.com
If the above step produces an error, e.g. /var/log/exim4/mainlog shows "Unroutable address", and your bugzilla server is inside a domain with local DNS, check to ensure your MX records are configured correctly on your DNS server.



Dec 3, 2011

How To Create Music CDs From MP3 in Ubuntu 11.10

In this post I'm going to show you how simple it is to create music CDs From your MP3 music in Ubuntu 11.10. I decided to write this post in response to some information posted by Sarkis Dallakian, Ph.D pertaining to cd burning programs on the wintarded operating system. You can see the original post here: http://tinyurl.com/7p27gxn

What I used in this demonstration:
  • Ubuntu 11.10 GNU/Linux on my computer
  • Some sample tracks of legally obtained MP3 music
  • 1 Blank CD-R disc of the 700MB, 80 min (imation 1x-52x is what I have)
  • MP3 support in Ubuntu - Terminal command: sudo apt-get install ubuntu-restricted-extras

First, insert a blank CDR into the drive. If you get the application launch prompt as shown below, simply click Cancel to close it. See below. Note: We could click through and add the Brasero application as a default to the drop-down shown here but that's another topic.



Next, click the Ubuntu Launcher icon in the Unity menu... or hit the wintard button (that's the one with the wintard logo on it), then type in brasero and click on the Brasero disk burning utility icon to launch it. See below.


Next, Click the "Audio project" button to begin a new music CD compilation. See below.

Next, simply click the "+" button, and add your music files to the compilation (hold the ctrl button to select multiple non-contiguous files, or hold shift to select a range of files). With the music files selected, click the Add button to add them to your compilation. Make sure the drop-down control near the bottom of the dialog shows the blank CD you inserted(as opposed to an image file name), and use the progress bar that appears there to monitor when the space for the CD is used up (will be between 10-20 music tracks depending on their length ). See below.



When you are finished adding music tracks to the compilation, Enter a descriptive name for the CD in the field provided(optional), then click the Burn button. Wait about 5 or ten minutes as the program "normalizes" the tracks and then burns them onto the CD disc.



That's it! Wasn't that easy! Now you can take the CD out to your car (or other standard CD player) and enjoy your music.


GNU/Linux - Freedom with a Universe of Free Software that comes with it. Get yours! See www.distrowatch.com or www.ubuntu.com for more information.


Humans Enabled - That's what Technology is for!


Shannon VanWagner
12-03-2011

Oct 17, 2011

Ubuntu GNU/Linux Used by Technologists on Home Makeover Extreme Edition

Ubuntu GNU/Linux in the Background at 22:09 on Home Makeover
So my biggest daughter comes to me and says, "Daddy, they're using Ubuntu (GNU/Linux) on (ABC's) Extreme Home Makeover Edition". 


So then we go onto hulu.com and she points me to the time section where Brent Bushnell the Son of Atari founder Nolan Bushnell is talking about a robot they're making for the show and sure enough - there in the background is a large computer monitor with the unmistakable colors of Ubuntu GNU/Linux as the desktop background.

So apparently they are using Ubuntu GNU/Linux to make the software controls for their Robot on the show. Sweet!


GNU/Linux is the Universal Operating System, even for awesome projects featured on Home Makeover Extreme Edition.


Yep.
Shannon VanWagner

Aug 19, 2011

Tether Android to Ubuntu / Fedora Linux

(Update 11-15-11 - CLICK HERE for the automatic setup script - Now Just 296KB! sha1sum: f3b79c2e191baf8060367681bae27ac75fab9886 ). Based on reader comments, I've added the functionality for the script to use either yum or apt-get (Fedora or Ubuntu). Includes updated Azilink by Charlie Snider - for Android 2.3.x. READ the install instructions here (e.g., PLUG YOUR DROID INTO THE USB FIRST!)) Let me know how it works for you in the comments.)



So if you're like me you recently picked up the fabulous Verizon Droid Linux-based phone, and now you're one happy camper.

I've been cruising along with my Droid (Android Linux based device) for a month now, and I'm happy as a clam. I have to tell you... The Verizon Droid is quite a fine Linux-based device indeed.

So now that I've used the Droid for awhile, I set out in search of a piece of functionality that I hadn't yet replaced from my Blackberry days. That is: The capability to tether my Droid as an Internet modem to my Ubuntu GNU/Linux 9.10 machine using the USB cable.

On the Blackberry, this was as simple as, a.) provisioning the data service through Verizon(yes, this does cost extra), and then b.) setting up the "Berry4All/BBTether" script (by the extravagant Mr. Thibaut Colar) on my Ubuntu Linux box.

In my search for a solution, the first place I checked for a tethering application was in the Android Market. And while there are many other applications, the only app I was able to find for tethering, required for my phone to be "rooted". And so instead of jumping right into that, I went looking for an easier solution, and voila! - I found it.

What I found are some easy tethering instructions by the masterful Shwan.c (link at ubuntuforums.org) using James Perry's azilink (modified for Android 2.3.x by Charley Snider) from Google Project Hosting, GNU+Linux, and the FOSS program openvpn. So now there was only one problem: I'm using the Verizon Droid, not the HTC Magic. The good news is that the process is generally the same, except for a difference in hardware id information for the udev rules settings in Ubuntu.

So after some minor changes, I've now successfully tethered my Verizon Droid via USB as a modem for my Ubuntu GNU/Linux 9.10 machine(Works with 10.04 too - only difference is that you may have to uncheck "Work Offline" in Firefox after connecting (Thanks to Gene for mentioning this)). Update:06-04-10 - I've tested these instructions and they work successfully with both the Motorola Droid and the HTC Incredible Android phones.

So here are the easy steps to get you up and running with using your Droid as a USB tethered modem (and a big Thanks to Shwan.c for posting the original idea):

1.) Download the current Android SDK (for Linux (i386)) from: http://developer.android.com/sdk/index.html

Update(thanks for comments!): 12-13-10 adb does not come with the new SDK by default so you have to add it via the Android SDK and AVD Manager.
2.) Extract the SDK, run the "Android SDK and AVD Manager", then to get the adb tool, install "Android SDK Platform-tools, revision 1":

tar xvf android-sdk_r07-linux_x86.tgz
cd android-sdk-linux_86
tools/android


In the Android SDK and AVD Manager, expand "Available Packages", put a checkmark by "Android SDK Platform-tools, revision 1", click "Install Selected" and follow the prompts to complete the download/installation of adb into your SDK folder (screenshot below).


3.) Change Directory into the "platform-tools" directory, then copy the "adb" application to your Ubuntu /usr/bin directory (sudo privs needed)
#From the extracted "android-sdk-linux_86" directory:
cd platform-tools
sudo cp adb /usr/bin/adb

4.) Create/edit/save a rules file for udev to allow your machine to see your device
sudo vi /etc/udev/rules.d/91-android.rules

Put the text below into the file(using "i" to enter "insert" mode and hitting the escape key to return to "select" mode before saving.. C'mon, what fun would Linux be without using vi? If you really don't like vi, you can substitute with something like gedit, or nano, or kate, or etc.), replace USERNAME with your Linux username, then type ZZ to save the file from vi.

SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME"
If you have an HTC Android phone - use this rule instead of the one above:
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME"
If you have the Samsung Galaxy Android phone, use this rule instead of the one above:
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME"  
If you have the Sony Ericsson X11 Android phone, use this rule instead of the one above (Thanks to Steven from the comments):
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME"If you have the LG Optimus V(Virgin Mobile) Android phone, use this rule instead of the one above: 
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", SYMLINK+="android_adb", MODE="0666", OWNER="USERNAME" 


5.) Set the appropriate permissions to the rules file you just created.
sudo chmod a+r /etc/udev/rules.d/91-android.rules


6.) Restart udev to load the new rule.
sudo restart udev


7.) Enable "USB debugging" on your Verizon Droid via Settings | Applications | Development


8.) Connect your Droid to the computer with the USB cable and then use the following adb command to check for your device.
adb devices


example:
$ adb devices
List of devices attached
040364FA0901E011


9.) Install openvpn on your computer so you can connect to your device with it.
sudo apt-get install openvpn
sudo /etc/init.d/networking restart
sudo /etc/init.d/network-manager restart



*For Fedora and Yum, replace the commands above with this:
sudo yum install openvpn
sudo /etc/init.d/networking restart



Note for those without Internet: If you need to install the openvpn package (and dependencies) separately, these packages are what you will need: (liblzo2-2 libpkcs11-helper1 openssl-blacklist openvpn-blacklist openvpn). It's best to use the package manager to install openvpn because it will automatically install the dependencies, but if you can't get your Ubuntu machine onto to the Internet, then you can download the above packages (in .deb format) to a separate medium (i.e., USB drive, CDR, etc.)separately and then install them in the order listed to achieve the same result as installing from the package manager.


10.) Install openvpn on your Verizon Droid. Note: the line "adb install" actually installs the azilink application on your Droid device. After azilink is installed, an icon that looks like a flying insect will appear on your Droid in th applications area.
cd /home/Downloads/
mkdir azilink
cd azilink
#Manually download the Azilink-debug.apk - fixed by Charley Snider for Android 2.3.x from

#http://code.google.com/p/azilink/issues/detail?id=43#c15
adb install -r Azilink-debug.apk
wget http://azilink.googlecode.com/files/azilink.ovpn


11.) Create a replacement resolv.conf file to be copied over to your /etc directory at run-time:
vi resolv.conf


#Type in the text below(hit "i" for insert first, then ESC after the insert, before saving) and then hit ZZ to save
domain lan
search lan
nameserver 192.168.56.1


12.) Now create a very small script to start the modem
vi start_modem


#Type in the text below, then hit ZZ to save
adb forward tcp:41927 tcp:41927
sudo cp resolv.conf /etc/
sudo openvpn --config azilink.ovpn


13.) Set your new script to be executable.
chmod 755 start_modem


14.) On your Verizon Droid, launch the azilink app and place a checkmark by "Service active" so it can receive the connection from your Ubuntu machine.


15.) With your wireless connection in Ubuntu "unchecked"(via right-click of the Network manager applet), launch the the connection script you just made in the Terminal:
/home/Downloads/azilink/start_modem


You should now be able to surf the Internet, using your Verizon Droid as a tethered modem. When you're finished - hit ctrl+c at the Terminal from which you started the connection script. Then uncheck "Service active" in Azilink on your Droid.


Here's a Speedtest (courtesy of speakeasy.net/speedtest) of the connection from Seattle, WA:
Download Speed: 1448 kbps (181 KB/sec transfer rate)
Upload Speed: 281 kbps (35.1 KB/sec transfer rate)


If you have any questions, feel free to leave a comment.

Aug 14, 2011

Google+ Here's my invitation to you (about 150 of you actually)

For those who haven't signed up to Google+, I extend my invitation (about 150 of them actually).

http://goo.gl/X5zCf

With Google+ you get:

Circles - control who has access to what, where messages get sent, etc

Hangouts - Video Cam chat with several people at once (also share youtube videos in the main area)

Games - Addicting, fun, Destined to waste your time.. Awesome!

Sparks - follow/share/collaborate about your interests

And, the reason I like it best:

Data Liberation - Download all your input to Google+ at any time (in zipped format) (yes, unlike fb)

Plus - so much more...

Cheers!

Shannon VanWagner

Aug 11, 2011

"Immutable" ( chattr setting ) - When You Can't Change a File in GNU/Linux



So today I learned about a little thing in the GNU/Linux filesystem called "chattr" and making files "immutable". Basically you can have a plain text file that you think you have full permissions over and then not be able to modify it, rename it, delete it, etc. This nifty (and possibly maddening) trick can be setup with the "chattr" command. See my examples below...

Create a simple text file
shannon@ubuntu-star:~$ echo Linux Rocks > testfile

Check the permissions of the file you just created:
shannon@ubuntu-star:~$ ls -l testfile 
-rw-r--r-- 1 shannon users 12 2011-08-10 23:47 testfile

Note that in the above state, I can write to the file, `mv` the file to a different name, `rm` it, etc. Now, for the magic (Or "basic commands" for a "novice" type stuff, according to http://tldp.org/LDP/abs/html/basic.html )

Use chattr to set the "immutable" attribute to the file.
shannon@ubuntu-star:~$ sudo chattr +i testfile 

Notice how nothing special shows in `ls` for the file:
shannon@ubuntu-star:~$ ls -l testfile 
-rw-r--r-- 1 shannon users 12 2011-08-10 23:47 testfile

And yet, magic ensues.. I can't edit the file, mv the file, rm the file, etc (even as root):
shannon@ubuntu-star:~$ echo Say it Again >> testfile 
bash: testfile: Permission denied
shannon@ubuntu-star:~$ sudo echo Say it Again >> testfile 
bash: testfile: Permission denied
shannon@ubuntu-star:~$ mv testfile testfile2
mv: cannot move `testfile' to `testfile2': Operation not permitted
shannon@ubuntu-star:~$ sudo mv testfile testfile2
mv: cannot move `testfile' to `testfile2': Operation not permitted
shannon@ubuntu-star:~$ sudo rm testfile 
rm: cannot remove `testfile': Operation not permitted

Amazing!

So now to stop the madness:
shannon@ubuntu-star:~$ sudo chattr -i testfile
shannon@ubuntu-star:~$ mv testfile testfile2
shannon@ubuntu-star:~$ ls -l testfile2
-rw-r--r-- 1 shannon users 12 2011-08-10 23:47 testfile2

So if you ever find yourself not being able to edit a file, and if you already know the partition you're working on is not set to read-only, and if you already know that you have full permissions to change a file - maybe "immutable" is your problem...

Setting the immutable property is only one of the options for the chattr command, run `man chattr` to read about other things you can do.

So I learn something new with GNU/Linux every day. Is this awesome or what?

PS: If you've ever wondered what chmod 753 means, here's the answer:
7 -  "owner" gets to read/write/execute
5 -  "group" gets to read/execute
3 -  "others" gets to write/execute

Cheers!
Shannon VanWagner