After updating GNOME to 3.20.2 I had some problems with my touchpad so in that confusion I mistakenly deleted /usr/bin/touch and after that I even became more stupid and deleted /bin/touch.

Now after this I can't seem to install any of the programs. Here's the error generated in installing a program..

user1@pqrx:~$ sudo apt-get install gir1.2-gtop-2.0
[sudo] password for user1: 

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/54.6 kB of archives.
After this operation, 104 kB of additional disk space will be used.
Selecting previously unselected package gir1.2-gtop-2.0:amd64.
(Reading database ... 351267 files and directories currently installed.)
Preparing to unpack .../gir1.2-gtop-2.0_2.34.0-1_amd64.deb ...
Unpacking gir1.2-gtop-2.0:amd64 (2.34.0-1) ...
Setting up gir1.2-gtop-2.0:amd64 (2.34.0-1) ...
sh: 1: touch: not found
update-kali-menu: error: Can't open /var/lock/kali-menu: No such file or directory
E: Problem executing scripts DPkg::Post-Invoke '[ ! -x /usr/share/kali-menu/update-kali-menu ] || /usr/share/kali-menu/update-kali-menu wait_dpkg'
E: Sub-process returned an error code

Any help will be much appreciated.

3 Answers 3


touch is included with the GNU core utilities. Since you deleted the program, you can use this command to attempt to reinstall it:

sudo apt-get install --reinstall coreutils 

Using only this command reinstalled deleted /usr/bin/touch and /bin/touch programs on a fresh install of Kali Linux 2016.1.

For other distributions, notably Mint (tested on 17.3 Cinnamon), running sudo apt-get update first may be necessary.

In general, one can determine which package is involved by searching dpkg for a file name in question, in your case:

dpkg -S bin/touch

You can work around (most) uses by making a shell script /bin/touch, and using that to repair your system enough to reinstall the package containing the actual executable.

Some applications will use touch to set timestamps. That is harder in a shell script.

For example:

for name in "$@"
    chmod +w "$name"
    printf '' >> "$name"
  • 1
    If the system has busybox, then wrapping busybox touch "$@" might be another option? Jul 26, 2016 at 20:35
  • or just a symlink to busybox.
    – Jasen
    Jul 26, 2016 at 20:37
  • It might, although it seems that busybox is most often discussed in terms of its differences from other utilities. Jul 26, 2016 at 20:41

I was very thankful for all the valuable time you guys spent answering my question and combining both the answers I found the best solution.

IF you have messed up with the coreutils then the best thing to do is download the coreutils file from the repository. As we all know that .deb files are basically archive, open it with the file-roller and extract the package and replace the necessary files, set the required permissions and reboot.

Its done.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .