Preseed Kali Linux from a mini ISO

My journey to a customized automated installation

honze
honze
Dec 19, 2017 · 4 min read

When I install a new Kali Linux, I like to do it automatically. So I forked a Kali Linux preseed configuration and fitted it to my needs. This was roughly three month before Offensive Security added that preseed configuration to their GitHub. But it did not work with the mini ISO of Kali and the command you have to type was very long and annoying. I got frustrated. So I decided to dive deeper and generate a better preseed configuration. I could have stopped there. It works for me. But I wanted to document at least what I have done, so that the next one facing this problem would have a small guide.

Note: I excluded all dead ends from this article, because there were a lot of them and it would be unbearable to read. I try hard and I fail hard, so I tried harder and failed harder. 🤪

Maybe the preseed configuration I have generated does not fit your needs. It probably wont. This is why I try to explain my way and the finished preseed configuration so that you can change it yourself!

TL;DR

Tailor this to your needs: https://github.com/honze-net/kali-linux-custom-preseed/blob/master/kali-mini-preseed-custom.cfg

Prerequisites

This article assumes that you use the mini ISO (~40MB). Maybe other ISOs will work, but you will have to put a bit of work into that. Secondly I use VirtualBox most of the time. So the guest additions will be included. If you use a different hypervisor, you should exchange the package for guest additions.

If you want to install Kali Linux to bare metal, I recommend doing a manual installation. If you need to deploy Kali Linux to large quantities of metal, then you are on your own, but I am sure that you know what you are doing, anyway. 🙂

Manual installation

I recommend to do a minimal manual installation first. Take note of every option you set during the installation. Finish the installation and then list all packages you need to have a fully installed system. This way you can change your custom packages more easily and you have more control over packages, which tend to bloat. For example compare gnome with gnome-core. There is a lot room for optimization, but I recommend solving one problem at a time! For now I use these packages: gnome kali-linux-full virtualbox-guest-x11 This is close to the installation of a regular Kali Linux from a weekly ISO.

Maybe you want to record your installation process with video capturing so you can rewind and play back. I took notes with pen and paper.

Fork an existing preseed configuration

I heavily recommend forking an existing and working preseed configuration! So you want to start with the kali-linux-rolling-preseed.cfg from the Offensive Security GitHub. For a better understanding I compare this to my configuration. I removed all comments, empty lines and sorted it, because I rearranged some lines in my configuration for convenience. Here is the relevant diff in handy chunks:

< d-i console-keymaps-at/keymap select us
< d-i debian-installer/locale string en_US.UTF-8
---
> d-i console-keymaps-at/keymap select de
> d-i debian-installer/locale string de_DE.UTF-8
< d-i keyboard-configuration/xkb-keymap select us
---
> d-i keyboard-configuration/xkb-keymap select de
< d-i time/zone string US/Eastern
---
> d-i time/zone string Europe/Berlin

As you can see, I am from Germany. So you want to use your own keymap, locale and time zone. Here you can refer to your notes from your manual installation.

< d-i mirror/country string enter information manually< d-i mirror/http/proxy string< d-i passwd/make-user boolean false

I also stripped three lines, which (I think) are not needed. Mirrors and user creation work in Kali different than in vanilla Debian. So these lines should not have no effect. If you ever experience problems, please ping me and I will update this guide accordingly.

> wireshark-common wireshark-common/install-setuid boolean true

During the installation wireshark will ask you a question about groups and setuid etc. This answers the question, so that the installation runs without interruption.

> tasksel tasksel/first multiselect minimal
> d-i pkgsel/include string gnome kali-linux-full virtualbox-guest-x11

These two lines are the key difference between a normal installation and a mini ISO installation. If you use the regular preseed file with the mini ISO, you will get nothing but a black terminal. If you add these to your preseed file, it will do a minimal installation and then add all packages which are listed. This is a bit anticlimactic, but I want to point out that you can customize the heck out of it. You can install every package you like, so after the preseed installation has finished, you can start working instead of having the system upgraded and packages installed.

You can replace gnome with a different window manager. For example:

e17
gnome-core
i3
kde-standard
kde-full
kde-plasma-desktop
lxde
mate-desktop
xfce4

You can replace kali-linux-full with more or less tools as described here:

kali-linux
kali-linux-all
kali-linux-forensic
kali-linux-full
kali-linux-gpu
kali-linux-pwtools
kali-linux-rfid
kali-linux-sdr
kali-linux-top10
kali-linux-voip
kali-linux-web
kali-linux-wireless

You should replace virtualbox-guest-x11 with your guest additions, if you use something else than VirtualBox:

open-vm-tools-desktop fuse (VMware)
hyperv-daemons (Hyper-V)

Installation

After you created and uploaded your own preseed configuration file, you can boot the mini ISO, press ESC, type auto url=<your-preseed-URL> and hit return. Lean back and enjoy your ride! 😎

Sources

The preseeding mechanism comes from the Debian installer and they have nice Wiki: https://wiki.debian.org/DebianInstaller/Preseed

honze

Written by

honze

www.honze.net — 1+1=10 — München

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade