Categories
News

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

Having upgraded a Nexus device to a later version of Android from a Linux computer, we find out if this helped improve support for Kali Linux NetHunter Rootless Edition.

In our article, How To upgrade Android for NetHunter from Linux (part 1), we successfully managed to upgrade a Nexus 7 mini-tablet from Android 5.1.1 to 8.1.0. This was carried out because NetHunter Rootless Edition failed with a kernel error on Android V5.1.1.

Here we find out whether the upgrade resolved the above error and examine whether this also addressed these additional issues:

  • Update & Upgrade problem
  • Full Kali Linux toolkit installation issue

The detailed instructions and screenshots during this How To are from an Ubuntu 20.10 desktop computer. There are planned future articles to cover the Android upgrade process from Mac and Windows computers as well as demonstrations of some of the NetHunter apps and other ‘rooted’ installation options.

Installing NetHunter

Now that our device has been upgraded to run a later version of Android, it is time to re-attempt the installation of NetHunter Rootless Edition using the following steps:

  1. NetHunter-Store app installation
  2. Required apps installation
  3. NetHunter Rootless Edition installation

For more detailed instructions please check out our How To install NetHunter Rootless Edition article.

Step 1 – NetHunter-Store app installation

Boot the Nexus 7 and perform the following on the device:

  1. Open web browser and visit https://store.nethunter.com.
  2. Click on the ‘DOWNLOAD STORE APP’ button.
  3. Press ‘Allow’ then ‘DOWNLOAD’ if prompted.
  4. Open File Manager and navigate to the ‘Downloads’ folder.
  5. Click on the ‘NetHunterStore.apk’ file. First time this is carried out it will be blocked so open ‘Settings’ at the prompt and turn on ‘Allow from this source’. Press the back button then ‘INSTALL’.
  6. After installation completes open the NetHunter Store.
NetHunter Store on a Nexus 7.

Note: Sometimes a problem can be encountered whereby the NetHunter Store app is empty due to not updating the repositories. If this happens Uninstall and Reinstall the app.

Step 2 – Required apps installation

Search for and install the following apps within the NetHunter store:

There will be further prompts regarding permissions during the installation of the above apps.

NetHunter required apps.

Step 3 – NetHunter Rootless Edition installation

Open the Termux app and run the following commands (accepting all default prompts):

pkg install wget

wget -O install-nethunter-termux https://offs.ec/2MceZWr

chmod +x install-nethunter-termux

./install-nethunter-termux

Note: The final command will take some time, especially the ‘Extracting rootfs’ stage which can take many hours. The extract does not show percentage progress or similar so it is difficult to know how it is progressing. A useful change is to edit the following function within the script ‘install-nethunter-termux’:

function extract_rootfs() {
    if [ -z $KEEP_CHROOT ]; then
        printf "\n${blue}[*] Extracting rootfs... ${reset}\n\n"
        # Old code:
        #proot --link2symlink tar -xf $IMAGE_NAME 2> /dev/null || :
        # New code:
        tar -xvf $IMAGE_NAME
    else        
        printf "${yellow}[!] Using existing rootfs directory${reset}\n"
    fi
}

Testing NetHunter

Let’s test NetHunter if is functioning correctly by running the following commands in Termux:

nh

uname -r

ls -la

These login to the NetHunter CLI (Command Line Interface), display the kernel version, and long-lists the contents of the home directory:

Initiating NetHunter Rootless Edition and running Linux commands.

To test the graphical interface side of NetHunter run the following:

nh kex passwd

nh kex &

These set the password to the Kali NetHunter Desktop (KeX) and starts a user session:

Running commands to set KeX user password and initiating a session.

Next open the NetHunter KeX app and connect to display #1:

NetHunter KeX user session.

Now that we have established that NetHunter works properly, we can check out the additional issues encountered previously:

  • Update & Upgrade problem
  • Full Kali Linux toolkit installation issue

Update & Upgrade problem

After further investigation it turns out that in our original article, How To install NetHunter Rootless Edition, the Update & Upgrade commands were issued in Termux when they should have been performed within NetHunter as ‘root’!

Here are the correct commands:

nh -r

apt update && apt full-upgrade
Kali NetHunter Update & Full Upgrade with Postgresql issue.

The package update worked fine and so did most of the full upgrade with exception of the Postgresql database part.

Full Kali Linux toolkit installation issue

As with the Update & Upgrade problem, it was the same issue with installing the Full Kali Linux toolkit so here are the correct commands:

nh -r

apt install kali-linux-default

This step worked fine apart from the Postgresql part again.

Conclusion

The main advantage of NetHunter Rootless Edition is that a limited set of Kali Linux tools can be run on a Nexus device without having to ‘root’ it. The advantage of this is that all your favorite Android apps are still available for use.

Perhaps this limitation and ease of getting up and running is what you are looking for … or it can be treated as getting a taster for Kali Linux on your portable device before leaping into more advanced tasks such as ‘rooting’ and flashing Custom ROMs.

Here is a list of key features provided by NetHunter Rootless Edition:

  • App Store
  • Kali CLI (Command Line Interface)
  • All Kali packages
  • KeX (Kali Desktop Experience)
  • Metasploit (without database)

Finally, a key tip in the NetHunter Rootless documentation is to perform regular backups of the ‘rootfs’ by stopping all NetHunter sessions then issuing the following command in Termux:

tar -cJf kali-arm64.tar.xz kali-arm64 && mv kali-arm64.tar.xz storage/downloads

Note: On older devices (32-bit) change ‘arm64’ to ‘armhf’.

The biggest problem encountered is the large amount of time it takes to extract the kernel which is most likely down to the speed of the device processor. Performing a ‘tar’ backup runs into the same issue. This will most likely be circumvented by installing ‘rooted’ versions of NetHunter which flash the ROM rather than running a large extract.

Watch for our upcoming articles on:

  • How To upgrade Android for NetHunter on Mac and Windows
  • NetHunter tools demonstrations
  • Installing rooted versions of NetHunter

Have you managed to get NetHunter Rootless Edition working properly on a smartphone or tablet? If so please share what steps you took, what configuration and specification the device was, and any other thoughts in the comments below.

Leave a Reply