# Ubuntu – Tar is uninstalled, how is it possible to reinstall it

14.04aptpackage-managementtar

I was doing some stuff on my Ubuntu PC, when I did

sudo apt-get autoremove tar


and messed up my computer. I apparently wanted to reinstall tar, but instead removed it thinking I would install it after it is removed. This was a mistake and I regret doing it.

Now, I can hardly do anything with tar not installed in my computer. I can't install any packages using apt-get, neither can I install packages using dpkg. I tried downloading a .deb file of tar and installing it in my computer using dpkg, but as I said I couldn't do that either.

I can't install tar using apt-get either, so I couldn't figure out how to install tar in my computer again.

I tried searching on websites including AU, but couldn't find a solution to this.

How can you install tar without having tar installed in your computer? (solutions with apt-get, dpkg etc will not work) I'm on Ubuntu 14.04 LTS.

• I solved the problem with some hacky workarounds, but it works. Might not be the best way to solve the problem though. I got the answer by following some parts of @steeldriver's comment and adding some of my own.

cd ~/Downloads/


and then doing

ls | grep tar


to make sure the download succeeded. You should get an output similar to

tar_1.27.1-1ubuntu0.1_i386.deb


I'm going to use the name mytar.deb for the answer, but replace that with the real name of your .deb file

Now, you need to extract the contents of the .deb file without using tar.

First do

ar x mytar.deb


which will extract the files from the archive into the current directory. To list the files present, do

ar t mytar.deb


which will output something similar to

debian-binary
control.tar.gz
data.tar.xz


data.tar.xz contains the actual files which we need to copy. We cannot use tar to extract them because our current computer does not have the tar command.

First lets convert data.tar.xz to data.tar. To do this, do

xz -dc < data.tar.xz > data.tar


which should create a new file data.tar.

Now, we need to create a link to busybox as mentioned by @steeldriver in the comments. So do

sudo ln -s /bin/busybox /usr/local/bin/tar


Then, you basically are using busybox instead of tar. So if you use the command tar, it invokes busybox instead. Now do

mkdir temp


to create a dummy directory. Then

tar -xf data.tar -C temp/


to extract the .tar file and dump its contents in the directory temp. Change the working directory to temp by using

cd temp


Then do,

ls -pal


to get an output like

total 28
drwxrwxr-x  5 ashish ashish  4096 Jan 11 08:41 ./
drwxr-xr-x 23 ashish ashish 12288 Jan 11 08:41 ../
drwxr-xr-x  2 ashish ashish  4096 Jan 11 08:41 bin/
drwxr-xr-x  2 ashish ashish  4096 Jan 11 08:41 etc/
drwxr-xr-x  5 ashish ashish  4096 Jan 11 08:41 usr/


If you do not get the folders like bin, etc, and usr, you have made some mistake.

Now, you can just copy all the files in those folders to the actual destinations (/bin/tar, /usr/local/bin/tar etc), and then do

tar --help


If you get an output showing the commands of tar, it works!

Now do

sudo apt-get install --reinstall tar


which should reinstall tar. If it gives you an error saying to run apt-get -f install, do that and then reinstall tar, it worked for me on Ubuntu 14.04 LTS.