How to stop Katoolin from crashing Ubuntu?
I updated from 14.04 to 16.04 and used katoolin
to add some Kali tools. After restart, the boot up of Linux ran codes, but stopped at a certain point never to load login. So I reinstalled 16.04, ran updates and tried again. This time, the boot menu was changed to Kali as well as the OS name (I'm using Windows 7 dual boot with Ubuntu); login started in Ubuntu style without user name, had to type in the name... then it goes to the logo screen never to log in.
How can I use katoolin
without it affecting the boot menu interface? Does this happen when the user selects the option 'add Kali repositories and updates'? Are the Kali repositories necessary? I'd much rather just install the tools and not mess with the Ubuntu interface.
Solution 1:
Warning about updates after installing Kali linux tools
The LionSec Katoolin GitHub webpage clearly warns Katoolin users to be careful when updating software.
Before updating your system, please remove all Kali-linux repositories to avoid any kind of problem.
All kinds of problems can occur if you don't do this.
Additional reference: How to install Kali linux tools in Ubuntu 15.10
Are the kali repositories necessary?
Katoolin is a script that makes it quick and easy to install may Kali linux tools at the same time, however adding Kali repositories is not always necessary. For example read this answer to a question about how to install only two Kali linux tools, which can also be easily installed without adding Kali repositories.
Adding only the Kali linux tools that you need manually is good training that teaches you how to use the other package management tools that are provided by the default Ubuntu repositories and which are safer than Katoolin because they don't add a long list of additional repositories to your software sources.
If you need to install a lot of Kali linux tools you should also consider installing Kali Linux itself, either as a dual boot or in a virtual machine. If you have done what looks like irreparable damage to your system with Katoolin, I recommend that you remove all the Kali linux repositories that you added from your software sources and with the help of the terminal history
command remove all the packages that you installed with Katoolin, and start over again with vanilla Ubuntu.
Solution 2:
TL;DR:
It's not Katoolin which crashes Ubuntu. Instead they are the packages from the Kali repositories which replaces that of Ubuntu. So, Do not update and upgrade your Ubuntu installation while Kali's repository is in use.
What issues may occur?
Katoolin's Python Script basically adds repository information of Kali which looks like this:
# Kali linux repositories | Added by Katoolin
deb http://http.kali.org/kali kali-rolling main contrib non-free
Since now the repository information of Kali is also in use, APT might think that the new version of packages are available. APT would try to "update" those packages and replace the Ubuntu packages with those of Kali. This might create severe dependency issues which is even impossible to solve. If you are brave enough and try to solve that, you might face dpkg error: "trying to overwrite file, which is also in..." kind of problem. And if you overwrite that forcefully you might end up with a broken system in which it's even impossible to connect to the internet since configuration might be horribly affected. And the worst thing is that you would be using Kali, not Ubuntu, after that.
How do I remove the repository information of Kali?
According to this answer about the warnings LionSec Katoolin GitHub states, so there's no need to keep those repository information in sources.list unless you want to update those tools. Ubuntu automatically checks for updates once a day, therefore, even if sudo apt update
command isn't run manually, it will be run automatically.
The script do provide an option to remove those repositories under "Add Kali repositories & Update" option. These are the lines of code that are inspired from the script and removes the Kali's repository information.
#!/usr/bin/python3
import os
infile = "/etc/apt/sources.list"
outfile = "/etc/apt/sources.list"
delete_list = ["# Kali linux repositories | Added by Katoolin\n", "deb http://http.kali.org/kali kali-rolling main contrib non-free\n"]
fin = open(infile)
os.remove("/etc/apt/sources.list")
fout = open(outfile, "w+")
for line in fin:
for word in delete_list:
line = line.replace(word, "")
fout.write(line)
fin.close()
fout.close()
To download and run the above Python 3 code, run:
git clone https://github.com/kulfy1/Katoolin_removal/blob/master/script.py
sudo chmod +x script.py
sudo ./script.py
Or comment the line which is equal to deleting the information using sed
:
sudo sed -e '/kali/ s/^/#/' -i /etc/apt/sources.list
And then finally run:
sudo apt update
Is there any safer method to install the tools then?
Having a safer and convenient method doesn't exist as far as I know. If you want convenience, then it won't be safe unless you are careful. If you are careless, go for safer method. The safer method simply includes determining the dependencies of the package needed, downloading the deb packages from Kali Archives, and finally installing using DPKG using the command
sudo dpkg -i file.deb
Since this method won't alter the sources.list, so there's nothing to worry about. But on the other side, it requires manual determination of dependencies and installing thereafter, so it may be full of hassles.
I wasn't aware of the harms and I updated my Ubuntu installation without removing Kali's repositories. What do I do now?
When the upgrade
is run, it shows thousands of packages will be upgraded. That's the moment when you can think once again if there's something missing or something extra. But if the upgrade has been already done, it might possibly fail affecting hundreds of packages. Then the dependency issues will arise. And if you satisfy them forcefully, you'll end up with a broken installation. If lsb_release -a
shows Kali, then the destructive things have already happened.
If you try to make it "Ubuntu" again, it would be too-broad, full of hassles and near to impossible. The reinstallation will take lesser time and will be more convenient. So, the only solution is to backup the data and install Ubuntu from scratch. And be aware of the Kali repositories in future.