Sunday, December 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.

Update 01/02/13 - Want to skip having to compile anything and simply access your device as a drive instead? Then simply install "Go-mtpfs" from +WebUpd8. See this link for the instructions.

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.

Warning:The method outlined here is meant to be an experimental / quick fix for testing. I say this because standard conventions of installing replacement shared libraries are not used here. For some great information on the subject, please have a look at this great post by Jeremy Mac Wright.

Assuming you are still OK with making such experimental changes to your system, here are the instructions:

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
 




Wednesday, December 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)". Tip: if, for some reason, your network manager icon is not displaying the VPN Connections selection, launch the terminal (ctrl+alt+t) and start a new Network Manager applet with the command 'nm-applet' (no quotes). This will make two Network Manager controls, but the second one will likely have the "VPN Connections" control.





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

Monday, December 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.



Saturday, December 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