Dual Boot Ubuntu with Kali Linux - Overview
If you are thinking of running Kali Linux and Ubuntu on your PC, you have two options. You can decide to use virtualization software such as VMware or Virtualbox and run one of the operating systems as a Virtual Machine. This method has its own pros and cons. However, one of the major drawbacks of virtualization is memory (RAM) allocation. If you have 8 GB of RAM on your PC and assign 4 GB RAM to the virtual machine (say Kali Linux), then your host OS (say Ubuntu) will only run on 4GB RAM. That will be okay if you are running regular software such as a video player. However, if you want to perform resource-intensive tasks such as WIFI Password cracking (wordlist) or Application development with Android Studio, your Operating System or GUI might freeze.
The second method and which we will cover in this post, is Dual boot Ubuntu and Kali Linux. That means installing two operating systems on your PC and selecting the one you want to use when booting your PC. When you install more than two operating systems, that is called Multiboooting. This method is much better since there are no memory (RAM) allocation issues, and each operating system can utilize the PC hardware resources to the fullest.
In this post, we will give you a step-by-step guide on dual-booting Ubuntu and Kali Linux.
Step-1: Requirements
In a dual-boot setup, what matters more is the available storage space available in your hard drive (HDD) or SSD. For the memory (RAM), I recommend using at least 4GB for efficient and reliable performance. The general requirements include:
- At least 50 GB of free storage space (assuming every OS will reside on at least 25GB size partition)
- Ubuntu ISO file
- Kali Linux ISO file
- A USB drive of at least 8GB size
Step-2: Partition your Disk
If you are well versed with Linux systems, you can partition the Disk while installing the operating. Otherwise, I highly recommend partitioning your disk first and avoid any formatting or installation errors that might occur. There are various ways that you can use to partition your disk. I recommend using Gparted for Linux systems or the Mini Partition tool if you are on Windows.
To install Gparted on a Debian-based distribution such as Ubuntu or Kali Linux, execute the command below:
sudo apt install gparted
Once it's installed successfully, you can proceed to launch GParted from the applications menu. In the window below, you can see we have 249 GB of unallocated space in our drive.
We will create two partitions of 25GB size each. Follow the steps below:
Right-click on the 'unllocated space' or the partition that you wish to resize.
If you had 'unllocated space,' click the option "New" If you are resizing an existing partition, select "Resize/Move" In our case, we are dealing with unallocated space.
A small window will pop up. Enter the size of your new partition and set the File system type as EXT4, as shown in the image below.
Click 'Add' when done. Repeat the same procedure to create your second partition. When done, click on the green tick button at the top to apply your changes.
Step-3: Install Ubuntu on one partition
Ubuntu is among the distros with a user-friendly and easy-to-use installation screen of all the Linux distributions I have worked with. If you are an Arch Linux user, then you really understand what I mean by "user-friendly." To get started, download the Ubuntu ISO file.
1. Download Ubuntu
Ubuntu is available in two releases: The Long Term Supported (LTS) release, which is supported for 5 years, and the interim release, which is supported for only nine months. As of writing this post, the latest LTS release is Ubuntu 20.04.2.0 LTS. Use the link provided to Download the Desktop ISO file.
2. Create a Bootable USB of Ubuntu
There are several tools that you can use to burn ISO files on your USB drive. In this post, we will use the Balena Etcher utility. It is a cross-platform utility available for both Linux and Windows.
It has an intuitive and easy-to-use user interface. It features three main options:
- Select File: This option enables you to select your downloaded ISO file to burn on your USB
- Select target: Use this option to select the USB drive you want to make bootable
- Flash: Click this button to start the flashing process. It might take a few minutes - please be patient.
3. Boot your PC with the Ubuntu USB Drive
If the flashing process completes successfully, you can boot your PC with the Ubuntu bootable USB drive. Follow the steps below:
- Completely shut down your PC and insert the bootable USB drive
- Start your PC and change the boot order by quickly pressing the boot key of your laptop brand. For example, HP uses F9; Dell uses F12; Lenovo uses F12 or the Novo; and so on.
- Select your USB drive from the Boot Menu to get started with installing Ubuntu on your PC.
4. Install Ubuntu
Your PC will boot from your bootable USB drive, and after some time, you will see the Ubuntu installation screen.
Select the desired language you want to use and click the Install Ubuntu button to start the installation. In the next screen, select the Keyboard Layout and click Continue.
A new screen will appear; you will need to select the apps that you want to install.
Select Normal Installation as shown in the image below.
That will install the basic software packages like the web browser, Libre office, games, and media players. Click Continue.
In the next screen, you will be required to select the installation type you want to use. There are four available options. Select Something Else as shown in the image below. That will enable us to select the partition where we want to install Ubuntu. Click Continue.
On the next screen, you need to select the partition where you will install Ubuntu. In our case, we have two partitions—25 GB which will host Ubuntu, and 33 GB which will host Kali Linux.
Select the partition where you will install Ubuntu and click the "Change" button below. A small window will pop up. Set the values below:
Use as: "Ext4 Journaling file system" and Mount point: "/"
When done applying the configurations, Click Install Now A window will pop up showing you all the changes made, confirm, and click Continue.
On the subsequent windows, you will be required to set the Timezone, Username, and password.
Once done, the system installation process will start. This might take some - please be patient.
When it's done, you will see a notification to Restart your PC.
Step-4: Install Kali Linux on another partition for dual boot
Up to this point, we have one operating system (Ubuntu) installed. Now let's dive in and create a dual-boot setup by installing Kali Linux alongside Ubuntu. The initial steps won't be very different from what we did above.
1. Download Kali Linux
Head over to the Kali Linux Download page and download the Bare Metal ISO file. As of writing this post, the ISO is available in three different formats depending on your system architecture. 64-bit, 32-bit, and Apple M1.
2. Create a Bootable USB drive of Kali Linux
Like, we did with Ubuntu, we will use Balena Etcher to create a Kali Linux bootable USB drive.
Click Flash from file and select the Kali ISO image you want to burn to USB. Click Select target to select the destination USB drive. When done, click Flash to burn the image to the USB drive. This process will take a few minutes. When done, shut down your PC.
3. Boot your PC with the Kali Linux bootable USB Drive
Now it's time to install Kali Linux alongside Ubuntu. Start your PC and press the boot key to change the boot order.
The boot key differs from one brand to another. For example, HP uses F9 while Dell uses F12.
When you get to the boot menu, select the USB drive containing your bootable image of Kali Linux.
After a few seconds, you will get to the Kali Linux installer menu.
4. Install Kali Linux Alongside Ubuntu
Select the Graphical Install option to start the installation process. The Linux kernel will start, and you might see lines of output running down your screen. After a few seconds, you will see a window to select Language.
Select the language you want to use in your system and click Continue. In the subsequent window, you will be required to select your location and configure your keyboard layout. When done, click Continue.
Next, you will be prompted to set the "Hostname." That is the name that will identify your system on the network. Just Enter any name and click "Continue"
On the next screen, you will see an option to enter a domain name. You can leave this field blank.
Once done, we will now get to the setup users and password section. You will see a window to enter the Fullname for the new user.
Next, set up the following:
- Username: It should always start with a lowercase character followed by any other combination of lowercase characters and numbers.
- Choose a password for the new user: A strong password should be more than eight characters long with a mix of letters, numbers, and symbols.
- Select your Time zone.
When done, you will get to the Partition disks window. Here you will need to select the Partitioning method that you want to use. This is the most crucial step in this tutorial.
Select "Manual Method" as shown in the image above. On the screen that appears, you will see the partition which contains Ubuntu and the other partition where we will install Kali Linux. Select the partition where you want to install Kali Linux.
Click Continue. On the window that appears, modify the following parameters.
- Use as: Select "Ext4 Journaling file system" from the dropdown menu.
- Mount point: Select "/"
You can leave the other parameters as they are. Scroll down and select "Done setting up partition"
You will be taken back to the "Partition disks" window. Scroll down and select "Finish partitioning and write changes to disk" Click Continue to start the installation process.
Halfway through the installation, you will see a window to select the software you wish to install.
When the installation is complete, you will see a prompt to install the Grub Boot Loader. Select the option "Install boot loader in the primary drive" which is labelled as /dev/sda
.
When the installation is complete, you will see a prompt to reboot your system.
Step-5: Dual boot Ubuntu and Kali Linux - Grub Boot Menu
If all the installations were successful, you should see the Grub boot menu when you start your PC, as shown in the image below.
From here, you can select the operating system that you want to use.
Step-6: How to choose default OS in GRUB
As you will notice in the Grub Menu, the last operating system installed is always listed as the first (default selection). In our case, the default set OS is Kali Linux. Luckily, you can change this.
Follow the steps below:
Start the last operating system you installed. In this case its Kali Linux and launch the Terminal and execute the command below:
$ grep menuentry /boot/grub/grub.cfg
Sample Output:
Copy the string of the operating system that you want to set as default. In our case its 'Ubuntu 18.04.3 LTS (18.04) (on /dev/sda1)'
Execute the command below to open Grub with the nano editor.
sudo nano /etc/default/grub
Change the value of GRUB_DEFAULT from 0
(zero) to the OS string you copied, as shown in the image below.
Save the file (Ctrl + S
) and Exit (Ctrl + X
) and execute the command below to regenerate the Grub menu.
$ sudo update-grub
Reboot your system to activate the changes.
Conclusion
Congratulations! You have successfully installed Kali Linux alongside Ubuntu. Dual-booting is a great setup for users who wish to experience the value offered by more than one operating system. In this case, you can practice penetration testing skills with Kali Linux and still use Ubuntu to perform your day-to-day activities.
When I intend to install Kali I get an error because the partition ext4 partition failed.
Any hint on this ?
Regards