If you executed a command on Ubuntu and messed up your system, there is hope. The apt-file utility can search the package repositories for the missing file and then tell you which package contains it. This is a good way to replace a system file that was accidentally deleted. This is impressive, and a good idea for the Linux user who tends to fat finger commands sometimes.
Install it like this.
jason@hoshi:/usr/bin$ sudo apt install apt-file |
Then scan all package databases to setup the utility.
jason@hoshi:/usr/bin$ sudo apt-file update Hit:1 http://archive.ubuntu.com/ubuntu cosmic InRelease Hit:2 http://archive.ubuntu.com/ubuntu cosmic-updates InRelease Hit:3 http://archive.ubuntu.com/ubuntu cosmic-backports InRelease Hit:4 http://archive.ubuntu.com/ubuntu cosmic-security InRelease Reading package lists... Done Building dependency tree Reading state information... Done 21 packages can be upgraded. Run 'apt list --upgradable' to see them. |
I am pretending this file was deleted, and I wish to restore it.
jason@hoshi:/usr/bin$ apt-file search /usr/bin/mksquashfs squashfs-tools: /usr/bin/mksquashfs |
But it is contained in the squashfs-tools package. So it can be reinstalled to fix the problem.
jason@hoshi:/usr/bin$ sudo apt install squashfs-tools --reinstall Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 21 not upgraded. Need to get 111 kB of archives. After this operation, 0 B of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu cosmic/main amd64 squashfs-tools amd64 1:4.3-6ubuntu2 [111 kB] Fetched 111 kB in 2s (55.5 kB/s) (Reading database ... 106010 files and directories currently installed.) Preparing to unpack .../squashfs-tools_1%3a4.3-6ubuntu2_amd64.deb ... Unpacking squashfs-tools (1:4.3-6ubuntu2) over (1:4.3-6ubuntu2) ... Setting up squashfs-tools (1:4.3-6ubuntu2) ... Processing triggers for man-db (2.8.4-2) ... |
This would have reinstalled the package and replaced the file that was missing. This should be a great help, this is how to reinstall a package and fix it if a single file from it is missing on your system.