Building updated Kali Linux ISO

Datetime:2016-08-23 01:50:56          Topic:          Share

Are you tired of downloading Kali Packages every-time you re-install? Kali Linux 2016.1? I know I am. The 2.6G ISO file was released back in January 2016 and since then it hasn’t been updated. This is an easy and quick way for building updated Kali Linux ISO for Kali 2016.2 and escape downloading same packages over and over and over again.

Ohh, yes, in case you missed it, Kali Linux 2016.2 has been in the wild since 2016-07-21, there just wasn’t any official announcement as it seems like an internal build-name/code. This also means, if you were like me who tries way too much and breaks system and keeps re-installing it, you are constantly doing the same apt-get update, upgrade and dist-upgrade to update you old Kali Linux 2016.1 to 2016.2. Here is the version info for Kali 2016.1

root@kali:~# cat /proc/version 
Linux version 4.3.0-kali1-amd64 (debian-kernel@lists.debian.org) (gcc version 5.3.1 20160101 (Debian 5.3.1-5) ) #1 SMP Debian 4.3.3-5kali4 (2016-01-13)
root@kali:~#

and here’s is the version info for Kali 2016.2

root@kali:~# cat /proc/version 
Linux version 4.6.0-kali1-amd64 (devel@kali.org) (gcc version 5.4.0 20160609 (Debian 5.4.0-6) ) #1 SMP Debian 4.6.4-1kali1 (2016-07-21)
root@kali:~#

So, Kernel is updated from 4.3.0 to 4.6.0 and build/release date is changed from (2016-01-13) to (2016-07-21). That’s 6 months worth of updates or i.e. 2 GB of download and no I am not even worried about the download. Personally, I am concerned about the time and effort. This post will also help those with slower Internet and/or download cap limited users. You do this once, keep that ISO and the only packages you will need it from that day ono. Sounds fair? I bet it does. Lets do it!

Building an updated Kali ISO is actually very easy and if you read Kali documentations, you probably do it already. If not, here’s some dot points to convince you:

  1. This process creates an ISO with the latest packages, so you don’t need to download any (or too many) in coming weeks.
  2. You can configure various desktop environments (such as KDE, Gnome, E17, I3WM, LXDE, MATE and XFCE) and create multiple ISO’s. Same deal for these ISO’s. They will have the latest and greatest packages already in.
  3. You can control meta-packages in your build and only download the packages you need to build your custom ISO. This fits perfectly for those who work in minimal environment or works using a particular application. Also less download, smaller ISO.
  4. You do use live-build hook scripts in various stages of the Kali ISO live build.
  5. You can include additional files or scripts in your build and create ISO with it. This helps when you are building it for a particular organization.

You can configure virtually any aspect of your Kali ISO build using the Debian live-build scripts. These scripts allow developers to easily build live system images by providing a framework that uses a configuration set to automate and customize all aspects of building the image. The Kali Linux development team has adopted these scripts and they’re used to produce the official Kali ISO releases.

Requirements

Ensure that your system meets the following requirements to avoid issues:

  1. About 20G free disk space.
  2. A decent Internet connection.
  3. Existing Kali environment.

Disk space seems to be the most important of all. This total process used about 17G space (I assume the system will use some swap for slower systems). You need the disk-space as this process will download all the packages, uncompress those and then create an ISO. I had around 55GB dedicated on my Samsung 850 EVO – 500GB SSD drive for Kali, so had absolutely no issues.

Getting Ready — Setting up the live-build system

We first need to prepare the Kali ISO build environment by installing and setting up live-build and its requirements with the following commands:

root@kali:~#  apt-get install curl git live-build cdebootstrap

root@kali:~#  git clone git://git.kali.org/live-build-config.git

Now you can simply build an updated Kali ISO by entering the live-build-config directory and running our build.sh wrapper script, as follows:

root@kali:~# cd live-build-config
root@kali:~/live-build-config# ./build.sh --distribution kali-rolling --verbose

The build.sh script will take a while to complete, as it downloads all of the required packages needed to create your ISO. Good time for a coffee. Yeah nah, go away for a about an hour or two.

and the final result?

root@kali:~/live-build-config# ls -ltrah images/
total 2.8G
-rw-r--r--  1 root root 2.8G Aug  4 23:18 kali-linux-rolling-amd64.iso
-rw-r--r--  1 root root 1.2M Aug  4 23:19 kali-linux-rolling-amd64.log
drwxr-xr-x 12 root root 4.0K Aug  4 23:19 ..
drwxr-xr-x  2 root root 4.0K Aug  4 23:19 .
root@kali:~/live-build-config#

a 2.8G Kali Linux rolling ISO for 64-bit systems. Nice!!!

Building a Kali Linux ISO for Older i386 Architectures

The Kali Linux i386 ISO has PAE enabled. If you require a default kernel for older hardware with PAE disabled, you will need to rebuild a Kali Linux ISO. The rebuilding process is much the same as described above, except that the 686-pae parameter that needs to be changed to 586 in auto/config as follows. First, install the prerequisites.

apt-get install git live-build cdebootstrap debootstrap
git clone git://git.kali.org/live-build-config.git

Next, make the change in auto/config for the appropriate architecture:

cd live-build-config
sed -i 's/686-pae/586/g' auto/config

Finally, run your build.

./build.sh --distribution kali-rolling --arch i386

Conclusion

I think this is a great idea. It really helps if you have a customwifi card or hardware that requires more packages (i.e. kernel-headers and drivers etc.). You can simply bundle those in your pre-defined build and create an ISO that will just WORK without any hassle.

Thanks for reading. If you’ve found this article helpful, do bookmark and share it. Any issues, let us know via comments section. As usual, commenting doesn’t require any registration and will always remain open.

Source: