How To...

How To upgrade Android for NetHunter from Linux (part 1)

In this 2-part article we look at How To upgrade to a later version of Android on a Nexus device from a Linux computer. We then see if this helps improve support for Kali Linux NetHunter Rootless Edition.

Our previous article, How To install NetHunter Rootless Edition, highlighted a problem with performing an install on a Nexus 7 mini-tablet running Android 5.1.1. After attempting this installation on two different pieces of identical hardware the same procedure was carried out successfully on a Nexus 5x smartphone running Android 8.1.0.

Some additional issues were also encountered whilst attempting an update/upgrade of NetHunter as well as trying to install the Full Kali Linux toolkit.

This article is in two parts:

  • Part 1 – to upgrade the version of Android on a Nexus 7.
  • Part 2 – to find out if the upgrade resolves the NetHunter Rootless install problem plus other issues:
    • Update & Upgrade problem.
    • Full Kali Linux toolkit installation issue.

The detailed instructions and screenshots during this How To will be from an Linux-based desktop computer (Ubuntu 20.10). Upcoming articles will cover the Android upgrade steps on Mac and Windows computers as well as provide demonstrations of some of the NetHunter apps and other ‘rooted’ installation options.


Our Nexus 7 has already had System Updates applied so that it now runs Android 5.1.1 (Lollipop) rather than 4.1 (Jelly Bean) that it shipped with. To upgrade beyond this requires the device to be ‘unlocked’ – effectively gaining access beyond what Google intended.

A unlocked device allows system-level utilities to be installed which in turn enable the ROM (Read-Only Memory) to be flashed with a new operating system. This has inherent risk in that if it fails then it ‘can’ render the device unusable or unrecoverable.

Warning: Proceed with caution and at your own risk!

Upgrading Android

In this section we aim to upgrade our Nexus 7 mini-tablet from Android 5.1.1 to 8.1.0 using the following steps:

  1. Backup data
  2. Determine the device specification
  3. Setup USB access & debugging mode
  4. Unlock the Bootloader
  5. Install a Custom Recovery tool
  6. Backup device
  7. Flash a Custom ROM

Advisory: We strongly suggest reading through the whole of this article prior to performing any actions.

Step 1 – Backup data

Upgrading Android is going to effectively wipe the tablet so all important files should first be backed up. This can be done by either of the following methods (this is not an exhaustive list):

  • Connect your device to a computer via a USB cable and make a copy of the files & folders using the File Browser. This requires setting the ‘USB computer connection’ to MTP on the device.
  • Log into Google on your device and select the following to backup your device to the Google servers:
    • Settings -> Backup & reset -> Back up my data
    • See here for more details.

If your device supports cell/3G then it is advisable to take a screenshot or note down the IMEI, IMEI SV & MEID numbers. A screenshot can be take by pressing the Power and Volume Down buttons simultaneously. This screen is accessible via:

  • Settings -> System -> About phone -> Status -> IMEI information

Note: Whichever method(s) you use, do make sure that the backup was successful prior to proceeding to the next step. If the backup was unsuccessful then re-attempt or try another method.

Settings to backup an Android device to the Google servers.

Later on we will be installing a Custom Recovery tool (see Step 5) which can be used to backup the whole device and restore it to its original state. In the event of a corruption or the device being ‘bricked’ this should not be relied upon so it is best to backup data as outlined earlier in this section for a ‘belt & braces’ approach.

Step 2 – Determine the device specification

There are two versions of the Nexus 7; 1st Generation (2012) and 2nd Generation (2013). This can be determined via:

  1. Obtain Model via ‘Settings -> About Tablet -> Model’ e.g. ME370T.
  2. Perform an online search for this Model to locate the device specification e.g. Wikipedia has good specification pages for the 2012 and 2013 models.

Ours turned out to be a 1st Generation (2012).

About Tablet settings on a Nexus 7 showing the Model and Android version.

In addition to the generation of the device, the other important piece of information we need is the variant:

  • Nexus 7 WiFi only – codename Grouper.
  • Nexus 7 3G – codename Tilapia.

Our device is WiFi-only so it is the ‘Grouper’ variant.

Step 3 – Setup USB access & debugging mode

In order to modify our Nexus 7 it is necessary to gain USB access to the device. Ubuntu 20.10 comes pre-loaded with the correct drivers though other distributions may not.

To verify if the right drivers are pre-loaded, carry out the following:

  1. Check if the device has the ‘Developer options’ menu under Settings. If you cannot see this under the System section then the device needs Developer Mode enabling. This is done by accessing the following menu and tapping ‘Build number’ 7 times:
    • Settings -> About tablet
  2. Connect a USB cable to the device and plug it into a computer.
    Note: Some Micro USB cables are power-only rather than data + power. Be sure to use the correct cable e.g. the one that originally came with your device.
  3. Set the ‘USB computer connection’ to MTP via the ‘USB Options’ link accessible by swiping down from the top of the screen.
  4. Open the File Browser on your computer and see if the device is listed plus that you can see folders like in the image below:
Folders within Internal Storage on a Nexus 7 accessed on an Ubuntu Linux desktop.

If the contents of the Nexus 7 are not visible then download and install the drivers for your Linux distribution.

Once the drivers have been installed repeat the above USB access steps to verify access.

Now that we have access to our device via a USB cable, the device needs USB Debugging enabling via:

  • Settings -> Developer options -> USB debugging

Step 4 – Unlock the Bootloader

A Bootloader is the first image to be run when an Android device is started. This checks and verifies the software on the device then brings up the operating system kernel. When a Nexus device is sold the Bootloader is locked. Unlocking it is essential in order to load a Custom ROM upon startup i.e. run an operating system that did not ship with the device.

To start the Unlocking process we need to be able to issue commands from our Linux computer to modify our Android-based Nexus. For this we will use Android Debug Bridge (adb) which needs installing via a CLI (Command Line Interface) Terminal window:

sudo apt update

sudo apt-get install android-tools-adb

sudo apt-get install android-tools-fastboot

Once the above tools have been installed connect the Nexus 7 via a USB cable to the computer. Ensure the device is powered on then run the following command to instruct it to reboot into the Bootloader:

adb reboot bootloader

The following prompt may appear on the Nexus 7, if so tick the box, press ‘OK’ and repeat the above ‘adb’ command:

‘Allow USB debugging’ prompt on Nexus 7 when prompted to reboot.

Once the ‘adb’ command has been successfully issued, a screen featuring the ‘green Android robot’ should appear on the tablet:

Nexus 7 rebooted into the Bootloader screen with confirmation of ‘VARIANT – grouper’ and ‘LOCK STATE – LOCKED’.

To perform the actual Unlocking, run the following command from the Terminal window:

sudo fastboot oem unlock

The following screen should appear prompting whether or not to proceed with the Unlock:

Unlock Bootloader prompt with associated warranty warning.

Proceed with the unlocking by pressing the Power button on the tablet. To cancel the unlock use the Volume Down button to select the ‘No’ option and confirm with the Power button.

Once the Unlock action has been performed the tablet will return to the Bootloader screen (with the green Android robot) now showing ‘LOCK STATE – UNLOCKED’.

The Unlock can be reversed by issuing the command:

sudo fastboot oem lock

Note: Performing the above Lock at this point will take your device back to the start of setup as though you did a Factory Reset!

Step 5 – Install a Custom Recovery tool

A Custom Recovery tool provides a number of functions with a key one being able to provide a safeguard in case a Custom ROM does not work. The device can then be restored back to ‘stock’ (the original Android version). Other facilities offered can include performing backups, rooting a device, and installing Custom ROMs.

Here are some tool options:

  • ROM Manager (aka CWM by ClockworkMod) – click here for details.
  • TWRP (Team Win Recovery Project) – click here to find your specific device.

We will use TWRP by flashing (installing) it to our Nexus 7:

  1. Open the TWRP web page above and find your device e.g. TWRP for Asus Nexus 7 2012 Wi-Fi.
  2. Under the ‘Download Links’ section click on your region.
  3. Download the latest image file e.g. twrp-3.5.0_9-0-grouper.img.
  4. Ensure your device is still ‘unlocked’ and in the Bootloader screen from the end of the previous step plus have the USB cable connected.
  5. Open a Terminal window and flash the TWRP image file:
fastboot flash recovery ~/Downloads/twrp-3.5.0_9-0-grouper.img
Flashing TWRP image to Nexus 7 using ADB.
  1. Providing the above instructions were successful use the Volume Down button to change the ‘Start’ option to ‘Recovery mode’ and press the Power button to select it. The device should now boot into the TWRP startup screen:
Nexus 7 booting into TWRP startup screen.
  1. Swipe right to Unlock then swipe right again to Allow Modifications. The main menu should now be presented:
TWRP Main Menu screen.

Step 6 – Backup device

Now is a good time to backup the Nexus 7 device as a whole so that we are able to return to ‘stock’ if problems occur. Within TWRP carry out the following:

  1. Click ‘Backup’ menu option.
  2. Optionally enter a backup name.
  3. Ensure System, Data & Boot are ticked.
  4. Fill in other Options & Encryption if desired though not essential.
  5. Swipe right to commence backup (~2.6Gb for a 32Gb device that has the base apps and little data):
TWRP backup of Nexus 7 in progress – note this does NOT include Pictures or Downloads! These should be backed up manually (see Step 1).
  1. Next, if your device supports cell/3G go back to the previous screen and check for special partitions e.g. EFS. If one exists then:
    • Untick the System, Data & Boot partitions.
    • Tick the special partition(s).
    • Optionally change the backup name.
    • Swipe right to commence the additional backup.
  2. When backup is complete press the ‘Back’ button to return to the Main Menu.

Step 7 – Flash a Custom ROM

Currently our device is running Android 5.1.1 (Lollipop). In order to upgrade the version of Android we need to download and flash a Custom ROM (sometimes referred to as firmware) and optionally* install the basic set of Google apps.

* The Nexus 7 mini-tablet is quite an old device so the full suite of Google apps can dramatically impact performance. An option is not to install these and instead only install the specific apps needed using their ‘.apk’ files.

Below we will perform an upgrade to LineageOS 15.1, which is an aftermarket firmware distribution of Android 8.1.0 (Oreo). This will be using a Custom ROM that meets the exact specification of our device e.g 1st Generation (2012) Grouper variant:

  1. Download the latest ZIP for LineageOS 15.1 (~270Mb) from here e.g.
  2. Download the latest ‘arm’ ZIP for MindTheGapps (~101Mb) from here if you want to install the Google apps suite e.g.
  3. Copy both of the above ZIP files into the Download folder on the Nexus device.
  4. You should still be on the TWRP main menu so click ‘Wipe’.
  5. Click ‘Advanced Wipe’.
  6. Tick ‘Dalvik / ART Cache’, ‘System’ & ‘Data’ options.
  7. Do NOT tick ‘Internal Storage’!
  8. Swipe right to Wipe.
  9. Press the back arrow until at the TWRP main menu again.
  10. Click ‘Install’.
  11. Navigate to the Download folder (if needed) and select the LineageOS ZIP file.
  12. Swipe right to confirm Flash.
  13. Optionally repeat steps 9-12 for the MindTheGapps ZIP file.
  14. Once the Flash is complete click ‘Wipe Cache/Dalvik’.
  15. Swipe right to Wipe.
  16. Once the Wipe is complete click ‘Reboot System’.
  17. LineageOS will now bootup which can take 5-10 minutes of just seeing an animated ‘sad smile’.
  18. Go through the setup screens.
Nexus 7 ‘About Tablet’ settings screen now showing Android 8.1.0.

Upgrading to Android 8.1.0 was successful and performance of the device without the Google apps suite installed was sufficient.

In part 2 of this article we will see how NetHunter installs on our newly upgraded device.

Do you have any experience of upgrading Android on a Nexus or similar device? Do you have a preferred Custom ROM? If so please share your thoughts in the comments below.

Leave a Reply