This tutorial will show you how to update Kali Linux so your system and applications will benefit from the latest features and security fixes.
Kali Linux is a rolling release, so that things might break during a system update. I strongly advise you to perform a full system backup before. If you use Kali in a virtual machine [VirtualBox, VMware, etc.], take a snapshot before proceeding with the updates.
I will show you the quick way to update Kali and an extended way, including clear explanations for every step involved in the process.
If you encounter any errors during the Kali Linux update, check the Troubleshooting section towards the end of this article.
Without further ado, let’s get started.
Update Kali Linux – The Quick Way
If you are in a rush and already know what you’re doing, you can use one command in Kali to update the cache and immediately start downloading and installing updated versions of packages – including system and non-system-related packages [Figure 1.1].
sudo apt clean && apt update && apt upgrade -y && apt dist-upgrade -y
Update Kali Linux – The Extended Way
If you’re reading this, it means you want to understand what you’re doing rather than just dropping a command in the terminal. Kudos to you!
Step 1: Log in as root
Open a terminal and login as root by executing the following command and type your root password when prompted:
NOTE: If you are using a live image of Kali Linux in VMware, VirtualBox, or ARM, the default root password is “toor” – without quotes.
Alternatively, you can type sudo in front of each command if you prefer to run the update using your user account instead of the root user.
Step 2: Check Source Repositories
To check if your sources.conf file is properly populated, execute the following command in the terminal [one at the time]:
cd / cat /etc/apt/sources.list
Ensure the deb http://http.kali.org/kali kali-rolling main contrib non-free line is uncommented, as shown in Figure 1.2 above.
If you receive any error [Err] message during the update/upgrade process, find the fix in the Troubleshooting section below.
Step 3: Update Kali Linux Source Repositories
In this step we instruct Kali to synchronize the package list on the local machine with Kali repositories. Kali uses this information to know which packages and their dependencies need to be updated.
To update Kali Linux repositories, execute the following command in the terminal:
As you see in the above capture, Kali detected 86 packages that should be upgraded in my system. You can use the apt list –upgradable command to list these packages – if needed.
Step 4: Upgrade Non-system Packages in Kali Linux
The command apt-upgrade command will instruct Kali Linux to proceed upgrading all the non-system related packages detected to be outdated during the repository update [previous step].
Type the following command in the terminal and type the Y key when prompted.
Kali Linux will automatically download and install the packages with older versions. Take note that this command will not remove the respective packages from the system.
Step 5: Update Kali Linux System Packages
So far, we have updated packages that are not part of the Kali Linux operating system. To update Kali Linux system packages, use the apt dist-upgrade command in the terminal and type the Y key when prompted.
Once done, reboot the system and keep your fingers crossed.
Sometimes, updating Kali Linux can be as simple as typing a command line in the terminal. Some other times, errors may occur when Kali is trying to update/upgrade your system.
One of the most frequently encountered problems when updating Kali Linux is the “Failed to fetch http://http.kali.org/.”
This is due to using http instead of https protocol for Kali repositories in the sources.conf file.
To fix this issue, edit the sources.conf file and replace Kali repository to use https instead of http.
In the terminal type the following command as root user:
Replace: deb http://http.kali.org/kali kali-rolling main non-free contrib
With: deb https://http.kali.org/kali kali-rolling main non-free contrib
Save and exit the sources.list file by typing the CTRL-X. When asked to save a modified buffer, type the Y key.
Use the apt update or apt-get update commands to synchronize Kali Linux repositories with your system packages and proceed with the system update as explained in the previous section.
Using apt vs. apt-get to update Kali Linux
If you’ve been using Debian-based Linux distributions, you might already know you can use apt-get instead of apt command.
The apt command is just a simplified apt-get to provide an easier way of handling packages in Debian-based operating systems.
On the other side, apt-get provides more command granularity to manage your system packages the way you want.
Table 1.1 shows the main differences between apt and apt-get commands used in this tutorial.
|apt update||Updates source repositories and finds the packages to be updated system wide.|
|apt-get update||Does the same thing as the apt update command.|
|apt upgrade||Automatically install but not remove packages from a system.|
|apt-get upgrade||Will upgrade the versions of all packages installed on your system. Will not install new packages.|
|apt-get dist-upgrade||Will install or remove packages to complete the upgrade process.|
|apt full-upgrade||Does the same thing as apt-get dist-upgrade.|
Keeping your Kali Linux system up-to-date is an important part of having your application and system free of bugs and security issues. You don’t have to check for updates every day.
According to the Kali Linux update guide, it is enough to check for updates every few weeks or so.
Kali Linux is a rolling release. Therefore issues may occur sometimes and some of your favorite Kali tools may break. Though Kali is very fast in fixing all the bugs related to the system and applications on it, make sure you test your favorite tools before proceeding with an engagement.
If you are using Kali Linux in VM, it is strongly advisable to perform a snapshot each time you intend to perform a system-wide upgrade.
Before You Go
You’re probably using Kali Linux because you have an interest in cybersecurity or just want to learn a few useful hacks.
This website centers around learning ethical hacking and penetration testing. I am sure you can find something that will help you become better at what you’re doing.
I hope you found this Kali tutorial useful. If so, do me a favour and share it around – it really makes a difference.