Monday, November 16, 2015

Installing Ndivia GTX 750Ti Driver on Linux Mint 17.2 Revisited

It was recently that I noticed it was not possible to install the Ndivia GTX 750Ti driver as outlined in step 5 of my blog titled ‘How to Install Nvidia GTX 750Ti Driver on Linux Mint 17.2 (Rafaela)’. I did not realize it at that time the blog was written, but attempting to install using the Driver Manager on a 64-bit Linux Mint 17.2 only resulted in failure when the ‘Apply Changes’ button was clicked. Although the ‘nvidia-346’ item was selected, upon clicking the ‘Apply Changes’ button, the only thing that happened is that the green progress bar briefly appears and the ‘xserver-xorg-video-noveau’ item was re-selected. Note that the message ‘1 proprietary driver in use’ will not appear. No other messages indicating what sort of problem it was, appeared – one of the few shortcomings of Linux Mint 17.2.

It was only after the above-mentioned discovery that I had a 'DOH' moment – I had forgotten to document the installation of the 32-bit architecture to the repository prior to installing the driver. Why is this required, you may ask. The short answer is that the Nvidia driver requires it.

To make a long story short, I had to edit the blog concerned to include the installation of the 32-bit architecture to the 64-bit repository and then updating it. This is, however, only applicable to a 64-bit Linux Mint 17.2 installation – you can safely ignore it for 32-bit installations.

Monday, November 9, 2015

How To Clone HDD or SDD Using GParted

I am a ‘dyed-in-the-wool’ computer enthusiast and love to experiment with computers – both hardware and software. Recently, during a series of experiments which involved a 500 GB SSD (Solid State Drives) and Debian Linux, I had to physically clone the SSD to a larger mechanical 1 TB HDD. A colleague of mine observed this cloning process and suggested that I document this on the Web so that other users may follow it if they want to carry out a similar move. I agreed with my colleague – the resulting document is what you are reading now.

I do most of my experiments on a small capacity SSD after which, when I complete my experiments and I wish to preserve the result, I normally clone the SSD to a much larger HDD, then wipe the SSD clean and start a new experiment on it.

Basically this document is all about cloning a smaller disk to a larger one. The simple reason for doing this is ‘space’ – a smaller SSD (which currently is costly), although much faster than a mechanical HDD, has a space limitation. The less-costlier mechanical HDD has more space, but is much slower than a SSD. You have to decide whether this trade-off is a worthwhile effort in cloning disks. If you can afford it, you can also use this guide to clone to a larger SSD.

The best part of the tools that was used in cloning the disks is that they are absolutely free – well, maybe the ISP charges are not, because you have to download them from websites. The main cloning tool used in this article is GParted (Gnome Partition Editor), and an auxiliary tool (called ‘tuxboot’) is only use at the beginning to create a GParted USB boot drive. The beauty of this tool is that it can run on both the Windows OS as well as the Debian Linux OS – Mac OS X users may have to resort to using the ‘dd’ command from a terminal in order to create the USB boot drive.

Note that, if done correctly, disk cloning can be done easily without have to mess around with the ‘/etc/fstab’ file in order to fix the UUID of the disk.

One more thing before we proceed to the disk cloning process and that concerns the firmware (the software used to control low-level tasks) on most modern motherboards. Basically there are two types of firmware: one is the old-style type BIOS (Basic Input/Output System) and the other is the new EFI or UEFI ((Unified) Extensible Firmware Interface). While most of us old fogeys are familiar with the BIOS-type firmware, the computer industry, as a whole, is heading towards the UEFI-type firmware. So it very important for computer enthusiast like me, to fully understand UEFI. There are a lot of documents and articles on UEFI found on the web – but they seems to have one goal in mind – confuse the hell out of the computer enthusiast – and they all have succeeded beautifully. However, not all is lost – there is at least one article at http://www.rodsbooks.com/linux-uefi/ that explains clearly what UEFI is all about. I recommend that any computer enthusiast worth his/her salt, read it and give thanks to Roderick W. Smith, the author – Thank You, Roderick W. Smith. Anyway, the method outlined in this article is based on a non-UEFI PC (which is a PC with old-style BIOS firmware) – however, it is quite possible that they may work for UEFI style layouts, although this has not been tested by me. Maybe I will cover cloning disk on a UEFI PC later.

Downloading and Creating a USB Boot Drive


Assuming you have a web browser on your current PC, point them at:

  • http://gparted.sourceforge.net/download.php to download the Gparted utility - currently at version 0.24.0-2. Click on the link that says ‘Download gparted-live-0.24.0-2-i586.iso’, wait a few seconds, and the download will start. Save the file (if prompted) and make a note of where the file was saved. This is the main cloning software and uses the Debian Linux OS as a liveCD for launching the GParted utility. Note that what was downloaded is an .iso file – you can burn it to a CD if you so wish, but for this exercise, we shall use the ‘tuxboot’ utility to create a boot USB disk.

  • http://tuxboot.org/download/ to download the tuxboot utility - click on the link that says ‘Files on SourceForge’. Depending on the PC's OS, the next screen will show the latest versions.

If you are using Windows OS, click on the the link that says ‘Download tuxboot-0.8.2.exe (5.1 MB)’. Wait for the download to finish, then navigate to the Downloads folder using File Explorer, and finally double-click in the downloaded file to install it.

If you are using Debian Linux OS, click on the link that says 0.8 (the latest version), then click on ‘Linux’ followed by clicking on ‘debian-amd64’ for 64-bit PC’s or ‘debian-x86’ for 32-bit PC’s. Download the .deb file and wait for the download to finish. Then navigate to the Downloads folder using File Manager and double-click on the downloaded file to install it.


NOTE: If you are using any other version of Linux OS or Mac OS X OS, then create the USB boot disk by using the ‘dd’ command from a terminal. DO NOT USE the tuxboot utility.

The full command for creating the USB boot disk is:

  sudo dd if=/path-to-gparted-live.x.y.z-w.iso of=/dev/sdx bs=4M; sync

Replace ‘/dev/sdx’ in the command above by the actual USB device – which you can get from the ‘dmesg’ command. Also replace the ‘path-to-gparted-live.x.y.z-w’ with the actual path and the .iso file name.



Make sure that you have a 1 GB (or larger) USB thumb drive for GParted. If you have existing data on the USB drive, make sure that you make a backup copy of the data. Then plug in your USB drive into the PC. If need be, reformat the USB drive – make sure that you use a FAT or FAT32 partition. Then launch tuxboot, select ‘Pre Downloaded’, set it as ISO, then navigate to the Downloads folder and double-click on the GParted .iso image file (see figure below). Make sure that your USB disk is correctly set to the correct device, then click the ‘OK’ button. Wait until the process is completed (see figures below) – you now possess a GParted USB boot drive.



Assumptions


For this article, I will make the following assumptions:
  • you wish to clone the SMALLER HDD (or SDD) to a LARGER HDD (or SDD). This SMALLER disk will be referred to as the SOURCE disk in this article.

  • the LARGER HDD (or SDD) is unformatted (with or without an MSDOS type partition table) – this disk will be referred to as the TARGET disk in this article.

  • the SOURCE disk contains the Linux OS (which you want to clone) on 3 partitions – one of which is an extended partition. Note that this is the standard way for the three most popular Linux distributions (according to Distrowatch) and this article assumes that you have followed suit. The 3 partitions are – root, extended and linux-swap. Note that if you have any other partition schemes, you can tweak this article to suit them.

  • the SOURCE disk uses a NON-UEFI type layout – it DOES NOT use a GPT type partition but a plain old MSDOS/MBR scheme. Although, this article is written specifically for non-UEFI layouts, it is possible that they may work for UEFI style layouts, although this has not been tested by the writer.


Procedure


A) Boot From GParted USB Drive:

  1. Attach both of your HDD's into the PC – old HDD (SOURCE disk) into secondary port and new HDD (TARGET disk) into primary port

  2. Plug in the GParted USB boot drive into a working USB port

  3. Switch on the power to the PC

  4. After the POST beep, press the key to get to the boot menu (F12 for a Gigabyte motherboard)

    NOTE: If you do not do press the boot menu key, the PC will automatically boot from the GParted USB drive but in UEFI mode. If this is what you wish, then go ahead and boot this way.

  5. Select the GParted USB drive as the boot device and press the ‘Enter’ key – make sure that the correct NON-UEFI USB drive is selected – not the USB drive that has ‘UEFI:’ as part of the name

  6. At the GParted Live startup menu (which appears next), press the ‘Enter’ key with the ‘GParted Live (Default settings)’ selected – the actual booting into the Live USB process will start – ignore any warnings and messages on the terminal while booting

  7. There will be 3 prompts that will appear next – at each prompt, press the ‘Enter’ key for the defaults – booting will continue until the Debian Linux desktop appears

  8. GParted will then automatically start (see figure below)


  9. GParted will start with the SOURCE disk identified as /dev/sda and the TARGET disk as /dev/sdb (this is contrary to the physical location of the disks but it's acceptable for cloning - just remember which device is the SOURCE disk and which device is the TARGET disk - see figure below)


  10. To select either the SOURCE disk (/dev/sda) or the TARGET disk (/dev/sdb), click on the downward pointing arrow on the top right hand corner of the GParted window, and select the required disk from the drop-down list


B) Copy Root Partition (/) From SOURCE to TARGET:

  1. Select the SOURCE disk (/dev/sda) and then click on the first partition (which is the 'root' partition in our example) of the SOURCE disk

  2. Right click on the first partition and select ‘Copy’

  3. Select the TARGET disk and then the unallocated partition – right click on this and select ‘Paste’

  4. On the window that appears next, resize the partition to suit (leave enough free space for a swap partition – that space must be equal or larger than the actual swap-space on the SOURCE disk)

    NOTE: You can do the re-sizing of the partition one of two ways – visually or manually:

    • visually: drag the right hand pointer on the re-size window (the mouse pointer will change to a 2 headed arrow) to the desired position – see figure below


    • manually: enter the partition sizes (in MiB – binary mega-bytes) into the respective fields below the re-sizing window – see figure below


    • The example shown in the figure is for re-sizing a 456.89 GiB (copied from a physical 500 GB SSD) partition to a 921.60 GiB (on a physical 1 TB HDD)

  5. Click on the ‘Paste’ button – the window will close – click on the ‘Apply’ button in the top menu bar (see figure below), then click ‘Apply’ again in the pop-up window to confirm


  6. Wait until the operation is finished (depending on the size of the TARGET disk, this process may take a while) – when completed, the ‘root’ partition has been copied – along with the MBR boot loader and whatever UUID that was assigned to the SSD during install – see figure below



C) Create Extended Partition On TARGET:

  1. Select the unallocated (free) space on the TARGET disk and then click on ‘Partition’ button on the menu and select ‘New’

  2. On the window that appears next, create an extended partition on the unallocated space by setting the ‘Create as:’ field to ‘Extended Partition’ and then click ‘Add’


  3. Then click on the ‘Apply’ button on the menu, then click ‘Apply’ again to confirm


  4. Wait until the operation is finished – when completed, an extended partition has been created on the TARGET disk



D) Copy Swap Partition From SOURCE to TARGET:

  1. Select the SOURCE disk (/dev/sda) and then click on the swap partition (which is the third partition in our example) of the SOURCE disk

  2. Right click on the swap partition and select ‘Copy’

  3. Select the TARGET disk and then the unallocated partition – right click on this and then click on the ‘Paste’ button in the pop-up window

    NOTE: If you fail to leave a large enough free space for the swap, the ‘Paste’ button will be grayed out and you will NOT be able to copy the swap. If this happens, try re-sizing the ‘root’ partition on the TARGET disk.


  4. The window will close – click on the ‘Apply’ button in the top menu bar, then click ‘Apply’ again in the pop-up window to confirm



  5. Make sure that the partition LAYOUT for the SOURCE disk matches the TARGET disk – note that the sizes of the partitions may differ

  6. Close GParted and perform a shutdown on the PC

  7. Physically remove the SOURCE disk but leave the TARGET disk on the PC


E) Re-install GRUB On The TARGET:

  1. Switch on the power to the PC

  2. After the POST beep, press the key to get to the boot menu (F12 for a Gigabyte motherboard)

    NOTE: If you do not do press the boot menu key, the PC will automatically boot from the GParted USB drive but in UEFI mode. If this is what you wish, then go ahead and boot this way.

  3. Select the GParted USB drive as the boot device and press the ‘Enter’ key – make sure that the correct NON-UEFI USB drive is selected – not the USB drive that has ‘UEFI:’ as part of the name

  4. At the GParted Live startup menu (which appears next), press the ‘Enter’ key with the ‘GParted Live (Default settings)’ selected – the actual booting into the Live USB process will start – ignore any warnings and messages on the terminal while booting

  5. There will be 3 prompts that will appear next – at each prompt, press the ‘Enter’ key for the defaults – booting will continue until the Debian Linux desktop appears and GParted will then automatically start

  6. Close the GParted application and start a terminal by double-clicking on the terminal icon (the terminal is required to re-install GRUB on the new disk)

  7. Execute on the terminal:

      sudo fdisk -l

    Check the name of the new root partition on the new disk. In this case, it’s /dev/sda1

  8. Mount this partition by executing:

      sudo mount -t ext4 /dev/sda1 /mnt

  9. Finally, re-install GRUB onto the new disk /dev/sda by executing:

      sudo grub-install --root-directory=/mnt /dev/sda

  10. Then un-mount the new disk:

      sudo umount /mnt

  11. Close the terminal, shut down the PC and remove the GParted USB drive

  12. Start the PC – if it successfully boots up with no problems, then you have cloned the disk perfectly

  13. Test the new cloned disk – if OK then congratulations!

A FINAL WORD: This article does not cover cases whereby the OS is NOT Linux - for example, Windows and Macintosh OS. For these, the reader may have to do their own tests with using GParted on these OS's (refer to GParted features for the file system support). Also, as explained, this article does not cover a PC based solely on the UEFI firmware – although this may be covered in a future article.

Thursday, October 29, 2015

How to Install Nvidia GTX 750Ti Driver on Linux Mint 17.2 (Rafaela)

All the wise old geezers says that “changes are inevitable”. I guess they were talking about hardware and software with respect to the computer industry – at least that is my opinion. Hardware and software progress is moving so fast nowadays that I cannot keep up with the pace and the changes that it brings. Allow me to elaborate.

Recently I upgraded some of my computer hardware to the latest (and greatest?) motherboard, CPU, memory, graphics card, etc. I had expected that using these new hardware with the latest in Linux (in general) would be easy – but I was wrong! Totally wrong! Boy, did I tear off my hair in despair in getting some Linux distributions to work with these hardware. To provide a short answer to the reason why: drivers!!! Some of the hardware are so new that proper drivers are not provided as standard – indeed some of them do not have Linux drivers (yet?). If they are available, they have to be downloaded from the manufacturer's web sites and installed separately to get the hardware to work properly under Linux.

Having solved the proper way to get these hardware and software to work nicely with each other, I came to realize that some users out there may face the same problems as me – hence the purpose of this article. It all about getting a specific graphics card – the Nvidia “Maxwell” based PCIe GTX 750Ti graphics card to work with a specific Linux distribution - the Linux Mint 17.2 (Rafaela). With a bit of tweaking the same procedures can apply to all “Maxwell” based Nvidia graphics card (GTX 750, GTX 960, GTX 970, GTX 980) with any Ubuntu-based Linux distributions.

A partial list of the new hardware is as follows:

  • Gigabyte GA-Z97-HD3 Motherboard
  • Intel Core i5-4590 CPU
  • Kingston DDR3 HyperX PC-1600 16GB RAM
  • Gigabyte (Nvidia) GTX 750Ti PCIe Graphics Card

Before we start, I will make the following assumptions:

  • You are doing a fresh install of Linux Mint 17.2 on a blank (unformatted) HDD or SDD

  • You are about to install the 64-bit version of Linux Mint 17.2 (codename: Rafaela)

  • You have somehow downloaded the .iso file and that you have either burned the .iso file to a DVD or, even better (highly recommended), created a bootable USB drive

  • The display cable (i.e., the cable connecting your PC's display port to the actual display) is connected to the Nvidia GTX 750Ti output port

  • You have set up the BIOS for both UEFI and legacy boot. See here for a concise explanation of the pros and cons of UEFI vs legacy BIOS. (Thank you Michael Johnson)

The following steps outlines the procedure for getting the proper driver installed for the graphics card:

  1. Insert the USB boot media (containing the Linux Mint OS) into one of the USB port and switch on the PC. Press the “F12” key after the POST beep and the boot menu will appear. Note that there are 2 items listed for the Linux Mint USB boot drive – one using UEFI (the word “UEFI” will appear in the name) and one using the legacy USB. Select which one you prefer. (Note that if you use the UEFI option, you will get a GPT type HDD or SDD and 3 partitions will be created under normal circumstances – one of which will contain the UEFI boot information.) Then press the “Enter” key.

    Note that if you forgot to press the “F12” key (or you respond too late after the POST beep) and you are using a blank, unformatted HDD or SDD, you will boot automatically using the UEFI mode (see item 2 below). On the other hand, if your HDD or SDD contains a bootable OS, the PC will automatically boot this.


    NOTE: If you using a DVD to install Linux Mint 17.2 and you have not inserted the DVD into the optical drive, then switch on the PC and press the “F12” key after the POST beep to enter the boot menu, open the DVD drive tray and insert the DVD, close the tray and wait for a few seconds until the light on the DVD drive stop flashing – then select the DVD from the boot menu and press the “Enter” key. This will only allow you to set up a legacy based install. If you wish to have a UEFI based install, then place the DVD into the optical drive as described above then press the reset key to restart the PC. Then let the PC boot up to the GRUB menu.


  2. If you have selected UEFI, the next window that will appear is the GRUB menu – press the “e” key to edit the boot parameters which will be displayed on-screen. Place the cursor on the line starting with “linux” and position it after the “}” and before “quite” (at the end of the line), and insert a space, followed by typing “nomodeset” (without the quotes). Then press the “F10” key to start the boot process.

    If you have selected the legacy mode, the next window that will appear is the Mint menu with a message that says automatic boot will start in x seconds (where x = number of seconds remaining before boot) – press any key to stop this automatic boot process and then press the “Tab” key to edit the boot parameters which will be displayed on-screen. Place the cursor after the “lz” and before “quite” (at the end of the line), and insert a space, followed by typing “nomodeset” (without the quotes). Then press the “Enter” key to start the boot process.

  3. The Linux Mint Cinnamon desktop will appear – the resolution of the screen will depend on whether you have selected UEFI or legacy mode.

    On a UEFI mode the screen resolution is set at 1024x768 on a hardware “laptop” screen. Note that you cannot change the resolution of this screen. On a legacy mode, the screen resolution is set at native resolution on a hardware detected screen.

    Note that, for both cases the message “Running in software rendering mode” will appear on the top right corner of the desktop. Do not be alarmed by this message – remember that we have not installed the driver for the GTX 750Ti yet and this message serves to remind us of that fact. You can dismiss the message by simply clicking on it.

  4. Then double click on the “Install Linux Mint” icon and the installation process will start – just follow the on-screen instructions. Since installation of the OS is purely personal and subjective, it will not be described in this article. At the end of the installation, reboot your PC. Then press the “F12” key after you hear the POST beep. The boot menu should appear.

    If you are using UEFI, select the UEFI name (“ubuntu” in this case) and press the “Enter” key. Quickly press the “Shift” key and keep it pressed while the PC boots and the GRUB menu should appear - release the “Shift” key. Press the “e” key to edit the boot parameters which will be displayed on-screen. Place the cursor on the line starting with “linux” and position it after “ro” and immediately before “quite” (at the end of the line), followed by typing “nomodeset” (without the quotes). Then press the “F10” key to continue the boot process. Note that failure to modify the boot parameters as stated, will result in the PC booting up to a blank screen. If this happens, press the PC reset button and try again.

    If you are using legacy boot, select the HDD or SDD and press the “Enter” key. Quickly press the “Shift” key and keep it pressed while the PC boots and the GRUB menu should appear - release the “Shift” key. Press the “e” key to edit the boot parameters which will be displayed on-screen. Place the cursor on the line starting with “linux” and position it after “ro” and immediately before “quite” (at the end of the line), followed by typing “nomodeset” (without the quotes). Then press the “F10” key to continue the boot process. Note that failure to modify the boot parameters as stated, will result in the PC booting up to a blank screen. If this happens, press the PC reset button and try again.

  5. After logging in, the Linux Mint Cinnamon desktop reappears - with the correct resolution but with the warning message, I might add.

    If you are using the 32-bit version of Linux Mint 17.2, click on the "Menu", then select "Administration" and lastly click on "Driver Manager". Enter your password and select "Nvidia-346" (as of October 2015) or higher - then click on the "Apply Changes" button. Wait till the green progress bar reaches the end and the "1 proprietary driver in use" message appears. Close the driver manager window and skip the following paragraph and go to step (6).

    If you are using the 64-bit version of Linux Mint 17.2, launch a terminal and execute the following:

      sudo dpkg --add-architecture i386
      sudo apt-get update


    The above commands serves to add the 32-bit architecture to the 64-bit repository and then update the repository. Note that this is required by the Nvidia driver. Now execute the following from the terminal:

      sudo apt-get install nvidia-346

    This will install the actual Nvidia-346 driver – the latest as of October 2015. If the driver is successfully installed, you should see the “DKMS: install complete” message. You should not see any error messages – just ignore any warning message about utf8 locales (if any).

    Note that this will only install the driver – not the Nvidia settings for the driver. To install that, execute the following from the terminal:

      sudo apt-get install nvidia-settings

    Close the terminal when done.

  6. Restart the PC and the login screen will appear – log in and the Linux Mint Cinnamon desktop will appear with no warning message. Note that you are now using the proprietary driver “Nvidia-346”. To see the information on your GTX graphics card, click on “Menu”, then select “Administration” and lastly click on “NVIDIA X Server Settings”. A window showing all the information on your GTX card will appear.


NOTE: If you find that shutting down or restarting your Mint PC takes a long time (and it will “beep” at you during the process), it does seem “normal” since this behaviour was present in several Linux Mint 17.2 PC with the same hardware which I helped to set up. Why this is so is something that I am still investigating.


Congragulations! You have now successfuly installed Linux Mint 17.2 with the Nvidia GTX 750Ti graphics card. Enjoy!

Sunday, August 9, 2015

How to Install Oracle Java and Android Studio on a 64-Bit Fedora 22 Gnome

This article is a ‘how-to’ for installing Oracle’s Java JDK 8 (or SE 8) and Google’s Android Studio on a 64-bit Fedora 22 PC. If you wish to develop software on the Android platform on your Fedora 22 PC, then this ‘how-to’ is for you. Note that most necessary steps are performed at the command line in a terminal – if you are not familiar with this, I suggest reading about it first before trying out this ‘how-to’.

Before we start off, a few words about Fedora 22. This Linux distribution has a few ‘first’ under it’s belt – it’s among the first linux distributions to use Gnome 3.16 (the Workstation version), Weyland instead of X11, ‘systemd’ instead of ‘sysvint’ – these are only the few ‘firsts’ that this Linux possess. Sharp-eyed readers may notice the ‘minimize’ and ‘maximize’ buttons on the various screenshots in this ‘how-to’ – this is only made possible by installing and using the ‘gnome-tweak-tool’ to change the Gnome setting. Please note that the standard window in Gnome 3.16 do not possess these buttons – I have no clue on why this is so! However, what is important for this ‘how-to’ is it’s ability to install and run Oracle’s Java and Google’s Android Studio without having to resort to too much tweaking.


STEP 1: Install Oracle’s Java SE (or JDK) 8

On a newly-installed and updated Fedora 22, only OpenJDK JRE (Java Runtime Environment) 8 is installed by default. This can be verified by executing the following in a terminal:

  java -version

The output is as follows:

  java version "1.8.0_51"
  OpenJDK Runtime Environment (build 1.8.0_51-b16)
  OpenJDK 64-Bit Server VM (build 25.51-b03, mixed mode)


Only the OpenJDK JRE is installed by default. Google’s Android Studio, however, requires the full Java JDK, and the recommended version is Oracle’s Java (JDK or SE 6 and above). So the first thing you have to do is to install the full Oracle’s Java JDK.

Point your web browser to the Oracle SE download page here and download the latest RPM version of the 64-bit JDK (not Server JRE or the JRE) – currently at version 8u51 (or 1.8.0_51). It is also recommended that you download the API documents, demos and samples for the JDK – although this is not required for Android development on Android Studio. Once the packages have been downloaded, execute the following commands in a terminal:

  sudo rpm -ivh Downloads/jdk-8u51-linux-x64.rpm
  sudo rpm -ivh Downloads/jdk-8u51-linux-x64-demos.rpm
  sudo unzip Downloads/jdk-8u51-docs-all.zip -d /usr/java/jdk1.8.0_51/


The first two commands above will install the JDK, demos and samples to the ‘/usr/java’ directory. The third command above will unzip the API documentation files to the ‘/usr/java/jdk1.8.0_51/’ directory. If you perform an ‘ls -la /usr/java/jdk1.8.0_51/’ command it will display all the files installed by the commands shown above.

To set Oracle’s Java as the default Java, execute the following command:

  sudo alternatives --config java

The current OpenJDK Java is currently set as the default as shown by the ‘+’ sign next to the ‘Selection’ number. To change the default to Oracle Java, type the correct selection number (’2’ in this case) and press the ‘Enter’ key. To verify the current default java, execute the following command again:

  java -version

The output is as follows:

  java version "1.8.0_51"
  Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
  Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)


Notice that the ‘OpenJDK Runtime Environment’ has changed to ‘Java(TM) SE Runtime Environment’ – this confirms that default Java has been set to Oracle’s Java.


STEP 2: Install 32-Bit Libraries

Note that Google’s Android Studio requires that a 64-bit Fedora 22 installation has the ability to run 32-bit applications. To do this, you have to install several 32-bit libraries to the system. Open a terminal and run the following command:

  sudo dnf install compat-libstdc++-296.i686 compat-libstdc++-33.i686 compat-libstdc++-33.x86_64 ncurses-libs.i686 zlib-devel.i686 ncurses-devel.i686

After this, you now have a 64-bit Fedora 22 PC capable of running Google’s Android Studio.


STEP 3: Install Android Studio

To download and install Google’s Android Studio, point your browser to here and click on the big green button, agree to the terms, and then click the download button. Wait for the download to finish and then start a normal (NOT root) terminal and execute the following command from your home directory:

  unzip Downloads/android-studio-ide-141.2117773-linux.zip

This will decompress the contents of the zip file downloaded into a new sub-directory called ‘android-studio’ in your home directory. To start Android Studio setup, execute the following commands, one by one:

  cd android-studio/bin
  ./studio.sh


A window similar to the one shown below will appear asking whether you would like to import any settings. If this is the first time you are using Android Studio, it will be likely that you don’t have anything to import. However, if you are moving from an older version of Android Studio, you may want to keep any settings made previously – in this case specify the location of the settings and let the setup wizard do the job.


Click on the ‘OK’ button to proceed. Android Studio will begin loading as shown in the figure below.


After a while, the Setup Wizard screen similar to the one shown below, will appear. Click on the ‘Next’ button to continue.


The next screen similar to the one shown below will appear. The Standard type of setup is already selected – this is recommended unless you want to customize the setup. Click on the ‘Next’ button and the the next screen will appear.


If you have virtualization technology enabled in your PC BIOS and Linux kernel, then it will be detected as shown on the wizard’s screen. You can read up more on this technology at the URL shown on the screen – remember that the web page there is for Windows only – to read more on Linux and Virtualization Technology, click here. Then click on the ‘Next’ button.


The next screen that appears as shown below is where you verify the settings made so far – if you do agree to accept the settings, click on the ‘Finish’ button. If you want to review or change any of the settings, click on the ‘Previous’ button.


The SDK components will begin downloading as shown in the screen below.


Once downloading and installation is completed, a log window will appear as shown. Note that this log window is where any error messages will be displayed. For example, if you had forgotten to install the 32-bit libraries in STEP 2, the Android virtual device Nexus 5 will not be successfully created and a message to this effect will be displayed in this window. Assuming that the log window does not display any error messages, click on the ‘Finish’ button.


The next screen shown is the Android Studio Welcome Screen itself (shown below). You have now successfully installed Android Studio on your Fedora 22 PC.


Notice the ‘Check for updates now’ on the last line of the window – click on ‘Check’ and if you already have the latest version, a window similar to the one shown below will pop-up. Click on the ‘Close’ button and skip the next three paragraphs.


If there are any updates, a window similar to the one shown below will pop-up. Click on the ‘More Info...’ button and a browser window will open, and the web page showing more information on the update will be shown. Close the browser when done and then click on the ‘Check’ button on the Android Studio again. A window similar to the one shown below will appear.



Click on the ‘Update and Restart’ button. The updates will begin downloading as shown.


Once the updates have been installed, you will be prompted to import the old settings (from the previous version) – just press the ‘Enter’ key and Android Studio will start once again.

You can now pause and admire your handiwork, then close Android Studio by clicking on the ‘x’ on the top right hand corner of the window. From now on, you should make it a habit to check for any updates to Android Studio (by clicking on ‘Check’) every time you launch it.

Remember that, at the moment, you have to start a terminal, change to the correct bin directory and then launch ‘studio.sh’ in order to start Android Studio. To make life easier, you can place a launcher icon in both your Gnome shell menu and ‘Activities’ dock. To do this, follow the steps outlined below:

  1. Start a regular terminal (NOT a root terminal), then use your preferred editor (’nano’ in my case) to create and open a new file:

      nano .local/share/applications/android-studio.desktop

  2. In the new file, enter the following lines:

      [Desktop Entry]
      Type=Application
      Encoding=UTF-8
      Name=Android Studio
      Comment=Google Programming IDE for Android
      Exec=/home/(your_login_name)/android-studio/bin/studio.sh
      Icon=/home/(your_login_name)/android-studio/bin/studio.png
      Terminal=false

    If you decide to cut-and-paste the above text, make sure to replace (your_login_name) with your actual login name. Save the file and exit the editor.

  3. Reload the Gnome shell by executing first ‘Alt-F2’ and then typing ‘r’ in the resulting ‘Enter a Command’ field, followed by the ‘Enter’ key.

  4. If you now click on the ‘Activities’ menu item, then on the ‘Show Applications’ icon (usually the last icon in the dock), you will find the ‘Android Studio’ launcher in the applications list (see below). To add the ‘Android Studio’ launcher to the ‘Favourites’ in the dock, right-click on the launcher icon in the applications list and select ‘Add to Favourites’ item in the window that pops up. To test the launcher, you can click on either icon – Android Studio should launch.



STEP 4: Configure SDK Manager

On the Welcome Screen and under ‘Quick Start’ of the Android Studio, click on ‘Configure’ and the ‘SDK Manager’ item (see below).



The SDK Manager (as shown below) will start and if there are any update packages, it will be shown on the ‘Install xx packages...’ button (where xx = number of update packages).


Click on that button, and the ‘Choose Packages to Install’ window will appear as shown below. Click ‘Accept License’ for all the items followed by a click on the ‘Install’ button.


The SDK Manager window will re-appear and the packages will be downloaded and installed as shown below. Once the packages has been installed, a window may pop-up saying that the SDK Manager has been updated and Android Studio needs to be restarted for the updates to take effect – do so as per the request.


Now it’s time to check what has been installed so far. On the SDK Manager window all installed packages are marked ‘Installed’ under the ‘Status’ column. Note that SDK packages has already been installed for Android M – the latest Android version (API 22) from Google. Other packages may have already been installed – just check the ‘Status’ column.

Depending on what Android devices that you wish to develop software for, you may wish to install additional packages for that device. For example, the author has an Android smartphone running Android version 4.4.2 (KitKat), so the packages marked as shown below, was selected to be installed. The ‘Install 6 packages...’ button was then clicked upon and the packages were downloaded and installed. Do not close the SDK Manager yet.







STEP 5: Configure AVD Manager

Click on ‘Tools’ and ‘Manage AVDs...’ from the Android SDK Manager menu and the Android Virtual Device (AVD) Manager window similar to the one shown below will appear.


Notice that an AVD called ‘Nexus_5_API_22_x86’ has already been defined by Google. As the name suggest, this is for the Nexus 5 Android smartphone and you can view it’s settings by selecting the AVD and clicking on the ‘Edit’ button. The window as shown below will appear. Take special note of the warning that appears as the last line in this window.


Make a note of each of the settings as this provide a guide for setting up an AVD of your own later. Click on the ‘Cancel’ button to close the edit window when done and you will be back in the AVD Manager window. Notice that there is another tab labeled ‘Device Definitions’. Clicking on this tab will show a window similar to the one below and they contain a list of generic AVD device definitions. You can use this list as a starting point for creating your own AVD later.


For now, let’s take a look at the pre-defined Nexus 5 AVD. To start an AVD, make sure that you click on the ‘Android Virtual Devices’ tab, select the AVD that you want to start (just the Nexus 5 AVD in this case), and then click on the ‘Start’ button. A window labeled ‘Launch Options’ (shown below) will appear.


Click on the ‘Launch’ button to launch the AVD. A ‘Starting Android Emulator’ window will appear (see below). If, for some reason, the loading was slow and/or errors occurred, it is possible that hardware virtualization plus Linux’s KVM (Kernel-based Virtual Machine) features are NOT supported in your PC. This will often happen if your PC is NOT using the newer version of an x86 compatible CPU – for example your PC is using an very old AMD CPU. It also can happen if you don’t have Virtualization Technology enabled in BIOS and you are using Intel Atom x86 CPU/ABI in your AVD. Alternatively, the KVM module is NOT loaded into your Linux kernel.


The error message on the KVM module not being loaded may look like the one shown below. If you see this you may want to make sure that Linux’s KVM module is loaded before trying to run the AVD.


Another possible error message may look like the one shown below. This is due to one of the CPU features being missing – SSSE3 (Supplemental Streaming SIMD Extensions 3) in this case. This can happen if your CPU is an older model AMD CPU. Note that even if this error message is shown, the AVD will still load but errors may occur during it’s usage. You will be made aware of this by error messages popping up about Google Play Store and Maps being stopped during running of the AVD.


Assuming that there were no errors during launching, the Nexus 5 AVD will be displayed as shown below. If this is the first time you are starting an AVD, a window (as shown below) will also appear. This is a thank you from Google and the setting for the usage statistic to be sent to Google. You can either accept or decline (by clearing the check mark) and then click on the ‘Proceed’ button. Meanwhile, the Nexus 5 AVD will be loading and will display the flashing ‘android’ sign.



Once the AVD has finished loading without any errors, the Nexus 5 AVD will appear in it’s full glory (see below). That was fast, wasn’t it? This is only possible with Virtualization Technology plus Linux’s KVM feature and with the PC’s BIOS set up correctly to use this technology.


As with an actual Android smart phone, you need to unlock the phone before you can use it (ignore any messages about backup). Click on the padlock icon on the AVD and swipe (move the cursor) upwards to unlock the device. The screen will change to one shown below.


Click on the ‘OK’ button and the main home page of the phone will appear (see below).


Click on the ‘Apps’ button (the center icon at bottom) and the screen will change to one as shown below.


Click on the ‘OK’ button and all the application software that were included with the AVD will be shown (see below).


To test out an example software, click on the ‘Browser’ icon – if your PC is connected to to the Internet, you should see a screen similar to the one shown below. Note the query below which ask you whether you want to share your location – if so, click on ‘Share location’, else click on ‘Decline’. If you had clicked on ‘Share location’, the screen will change to look like the one shown below.



Type something into the Google search box, using the on-AVD-screen keyboard – for example ‘fedora’ (see below).


Then click on the search icon. The page shown below will appear.


Click on the ‘Fedora’ (first item shown) that appears on the AVD’s screen. If everything works, the Fedora home page will appear (see below).


You can now play around with the Nexus 5 AVD – notice how fast the response is, thanks to Virtualization Technology plus Linux’s KVM features. You can safely close the AVD by clicking on the ‘x’ on the top right hand of the window. You will then be back to the AVD Manager window.


STEP 6: Setting Up Your Own AVD

If, for some reason or other, the Android device that you possess is not listed under the ‘Device Definitions’ tab of the AVD Manager, you can create one to correspond to your device. First make sure that you have selected the ‘Device Definitions’ tab, then click on the ‘Create Device’ button. You should see a screen similar to the one shown below.


Now make sure that you have all the details for your Android smart phone ready – search for it on the Internet or use your User’s Manual if the details are present in there. As an example, the author has entered the details for his Samsung Galaxy Note 2 in the figure below, then clicked on the ‘Create Device’ button.


You will be back to the AVD Manager window with the ‘Device Definitions’ tab selected. Notice that the device you created will be in the device list (and selected by default). The screen will look like the one shown below.


Note that you have only created a definition for the device but NOT an AVD for that device. To create an AVD, select the newly created device (if it is not already selected), then click on the ‘Create AVD’ button. You will see a screen similar to the one below. Notice that the ‘AVD Name’, the ‘Device’, and the ‘Target’ entries have been pre-entered from the new device definitions.


You can edit the entries mentioned above if you so wish, but for this tutorial, leave the entries alone. Note however, a warning message that no CPU/ABI system image has been selected yet will appear at the bottom of the window – do so now by clicking on the down-arrow to the right of the CPU/ABI item on the window and select the CPU as per your device specification. Since my Android smart phone is using the ARM processor, I decided to use the ‘ARM (armeabi-v7a)’ CPU/ABI as I will be testing software on that smart phone itself (more about this later). The ‘Hardware keyboard present’ item was also deselected. Notice that the warning message has now changed to ‘No skin selected’. Change the skin to ‘No skin’ by clicking on the down arrow on the Skin item and selecting ‘No skin’ from the list. The screen will now look like this.


If you have a web-cam on your PC, you can use it as your rear camera and/or your front camera. Click on the down-arrow on the ‘Back Camera’ and/or ‘Front Camera’ and select ‘Webcam0’ for the entries. You can safely skip these items or use ‘Emulated’ for both items if you do not have a web-cam on your PC. The RAM size was pre-selected – you can change this if you wish. Also, if you wish to have a SD card on your AVD, specify the size of this card – I have entered 200 as an example here. To make the AVD perform faster, the use of the host GPU is highly recommended – I have enabled this in the screen shown below.


Click the ‘OK’ button to create the new AVD. A log window will appear (see below) informing you of all the settings for the newly-defined AVD. Note that any error messages will also appear in this window – in this case, there are none. Click on the ‘OK’ button to dismiss the window.


You will be back in the AVD Manager window with the newly created AVD already selected (see below).


To start this AVD, click on the ‘Start...’ button then click the ‘Launch’ button on the Launch Options window that appears next (see below).


The AVD will now load – at a very much slower rate than the Nexus 5 AVD! First, the screen shown below will appear with a flashing ‘android’ sign in the middle of the display.


After a long while, the screen will change as shown below.


Click the ‘OK’ button and the screen will change as shown below.


You can go ahead to play around with this device. Just note that it is very slow to respond to clicks as compared to the Nexus 5 AVD. You can safely close this AVD by clicking on the ‘x’ on the top right hand of the window. You will then be back to the AVD Manager window.

If your PC is using an Intel x86 compatible CPU and you have set up your BIOS accordingly, you can edit the AVD (by clicking on the ‘Edit...’ button) for the newly-created device and change the CPU/ABI to the ‘Intel Atom (x86)’, then click the ‘OK’ button twice to re-create the AVD (see below).



To start the AVD, select it and click on the ‘Start...’ button then click the ‘Launch’ button on the Launch Options window that appears next (see below).



The AVD will now load – at a very much faster rate than previously. This illustrate the power of using the Intel Atom (x86) CPU/ABI together with a capable Intel x86 compatible CPU and Virtualization Technology plus Linux’s KVM features with Android Studio on your development PC! Just remember that the hardware virtualization feature only works on x86 compatible CPU’s. Also remember that older CPU’s (Intel or AMD) may also not work with these hardware virtualization features. If you are unsure about your CPU’s ability to support hardware virtualization, search the Internet for help.

Close the AVD when you have finished playing around with it. Then close the AVD Manager by using the ‘Alt-F4’ key (there seems to be a bug here since there is no ‘x’ on the upper right hand of the window to close it) and the SDK Manager (use the ‘x’ on the upper right hand of the window). Use the ‘Back’ key on the Android Studio window to go back to the main page.


STEP 7: Create a New Project Using Android Studio

Now that you have successfully installed Oracle’s Java SE and Google’s Android Studio and set up an AVD, it’s time to use Android Studio to develop software for the Android platform. We start off by using Android Studio to write a short and simple ‘Hello, World’ program, which you can run either on your AVD, or your actual Android device.

Launch Android Studio if it is closed and dismiss any tip screen if it appears (by clicking on the ‘Close’ button). Start a new project by clicking on the ‘Start a new Android Studio project’ item from the welcome screen (see below).


The ‘New Project’ screen as shown below will appear – fill in the details for the ‘Application name’ to ‘Hello World’ and ‘Company Domain’ to ‘anycompany.com’ as shown. The directory in which this project reside can be anywhere on your PC. In the example shown, I have placed the project in my home folder’s ‘Projects’ directory but you are free to use any directory you wish. Then click on the ‘Next’ button.


The ‘Target Android Devices’ screen will appear next (see below). Make sure that the ‘Phone and Tablet’ item is selected. The ‘Minimum SDK’ is pre-selected to be ‘API 15: Android 4.0.3 (IceCreamSandwich)’ and the reason why is as stated in the note below this field. If you are unsure on which minimum SDK to select, you can click on the ‘Help me choose’ item. For this tutorial, leave it at the pre-selected minimum SDK. Then click on the ‘Next’ button.


The ‘Add an activity to Mobile’ screen will appear next (see below). Select the ‘Blank Activity’ item if it is not pre-selected. Then click on the ‘Next’ button.


The ‘Customize the Activity’ screen will appear next (see below). Change the ‘Activity Name’ to ‘MyActivity’ and the rest of the items below will change as shown. Then click on the ‘Finish’ button.


Android Studio (the ‘Gradle’ part anyway) will then start building the project as shown below. Note that your project is a basic ‘Hello World’ app that contains some default lines so you do not have to enter those lines into the project. Later you can view the the Java source code for this ‘Hello World’ project in the Android Studio IDE.


When completed, Android Studio will display it’s main IDE screen (see below). If a ‘Tip of the Day’ window appears (also shown below), you can safely close it by clicking on the ‘Close’ button.


If this is the first time you are using Android Studio, the next screen will take some time to appear while the system will carry out indexing of the IDE – the word ‘Indexing...’ will appear in the bottom of the IDE window (see below).


After the system has finished indexing, a screen similar to the one shown below will appear. Note that it does contain a graphic of a Nexus 4 device with the ‘Hello world!’ text on it. This, however, is NOT the output of the project on your AVD.


To run this project on your AVD emulator that you have created, click on the ‘Run’ button (the one in Android Studio’s tool-bar that looks like a green-colored right pointing arrow) and the ‘Choose Device’ screen (see below) will appear. Note that the ‘Launch emulator’ item has been selected and that you don’t have any other running device (’Nothing to show’ will be present in the top half of the window). Make sure that the Nexus 5 AVD is selected.


Click on the ‘OK’ button and the AVD will start and the screen will change to the one shown below.


Unlock the AVD (like a regular Android smart phone) to run the project and the ‘Hello world!’ output will appear on the AVD (see below).


After admiring your handiwork, close the AVD and you will be back at Android Studio (see below). Notice that you are now viewing the contents of the ‘activity_my.xml’ tab. For the time being, just ignore any messages shown in the status area at the bottom of the Android Studio’s screen.


To view the Java source code for this project, just click on the ‘MyActivity.java’ tab and the screen will change to the one shown below.


Switch back to the ‘activity_my.xml’ tab and run the project again but this time, select the Samsung Galaxy Note 2 AVD instead (see below). Then click on the ‘OK’ button.


The screen will change to one shown below.


Unlock the AVD and and you will see the ‘Hello world!’ output on the AVD’s screen. Close the AVD after you are done.


We have successfully tested the ‘Hello World’ project on the AVD emulator. However, our ultimate goal is that the project should run on an actual Android device (a smart phone, for example). In order to do this, you need to connect that device to our development PC (the PC on which Android Studio is currently running) using a proper USB cable and the proper USB ports.

First you need to enable USB debugging on your device. Usually this setting can found under ‘Settings’ and ‘Developer options’ but it can vary from device to device (see below). On some Android devices, ‘Developer options’ may need to revealed as they are hidden by default. If unsure, consult your ‘User’s Manual’ or the manufacturer’s web page for the information on how to enable USB debugging.


If you find an item labeled ‘Revoke USB debugging authorization’ on your Android device, select that and clear all previous authorization by selecting ‘OK’. Note that if this item is not present on your Android device, you can safely assume that your PC is automatically authorized.


Next we have to make sure that the proper USB cable is used. The manufacturer of your Android device usually provide you with one – use that cable and none other. You also have to make sure that the USB port to be used on your PC is working. Test this port out first by plugging in a thumb drive (or any other USB device) and if the PC recognize this device, you can safely say that the USB port is working.

Now make sure that Android Studio is running the ‘Hello World’ project. Then connect your Android device to your PC using the USB cable. Dismiss any file manager window on your PC if one pops up. You may need to authorize the USB connection to the smart phone for debugging with the PC’s RSA key by selecting ‘OK’ on your smart phone (see below also).


Then click on the ‘Run’ button in Android Studio’s tool-bar. As usual, the ‘Choose Device’ window will pop up as shown below. Note that the ‘Choose a running device’ item is selected and that device is listed as shown (a Samsung GT-N7100 in this case). Click the ‘OK’ button to run the project on your Android device.


If everything is set up correctly, you should see the ‘Hello world!’ message displayed on your Android device’s screen (see below). If not, see if there are any messages on your Android Studio status screen of your PC. If the message mentions authorization (for example), then, most probably you have forgotten to set USB connection authorization on your device. Do it now and retry running the project again. The important thing to note here (if unsuccessful) is that Android Studio will display some message and this usually gives you a clue on what is wrong. If you still run into problems, then I suggest searching the Internet with your problem.


You can now close the window on your Android device (usually using the ‘Back’ key). If you examine the apps on your device, you will find an app labeled ‘Hello World’ (see below). This is, of course, the ‘Hello World’ app file (usually with a .apk extension) which Android Studio has downloaded for you. You can delete this file if you so wish. By the way, before you put your Android device aside after testing more new apps developed using Android Studio, remember to switch off USB debugging first.


To close the ‘Hello World’ project on your PC, click on ‘File’ and the ‘Close Project’ menu items on Android Studio. You will be back to the welcome screen and the ‘Hello World’ project will be listed under the ‘Recent Projects’ column (see below). To restart (or reload) the same project, make sure that the project is selected under ‘Recent Projects’ and then double-click the item (or click on the ‘Open an existing Android Studio project’ item, then select your project file) – that project will then be started.



Final Words:

That’s it. You now have a 64-Bit Fedora 22 PC which can be used to develop Android software. If you are an experienced Intellij, Android Studio, Java and Android programmer, enjoy! For those people who is new to Android Studio or Java programming, here are some links which I recommend you visit in order to learn about Android programming.

To learn about the Intellij IDE (on which the Android Studio is based), visit https://www.jetbrains.com/idea/documentation/ for a tutorial on this.

To learn how to use Android Studio for developing Android software, visit https://developer.android.com/training/index.html for a tutorial on this.

If you are new to Java, then I would recommend searching the web for tutorials and the books ‘Java For Dummies, 6th Edition’ and ‘Head First Java, 2nd Edition’ as a guide.

If you are new to Java Programming for Android, then I would recommend searching the web for tutorials and the book ‘Java Programming For Android For Dummies’ as a guide. There is also another book by the same author but is more ‘advanced’ and is targeted towards Android developers. The title of this book is ‘Java Programming For Android Developers For Dummies’.

Happy computing!