The output of cat /etc/apt/sources.list
was quite short, containing only two non-blank lines. It revealed that /etc/apt/sources.list
has the bionic
repository but is missing the bionic-updates
and bionic-security
repositories, which are typically present and enabled.
Adding them should fix the problem. The package you're trying to install, linux-tools-4.18.0-21-generic
, is provided in bionic-updates
.
Since all official updates to stable releases are released through the -security
and -updates
repositories, you may find a number of updates available for installation. It's a good idea to install those, unless you have a specific and important reason not to do so.
You can enable those repositories with the add-apt-repository
command or with either of the methods summarized below. Or you may want to follow one of the procedures given at How do I restore the default repositories?
Graphically
If your system has a graphical desktop installed, you can run the Software & Updates tool and enable them from there. To do that:
Open Software & Updates.
Click the Updates tab.
Under "Install updates from:" make sure these boxes are checked:
- Important security updates (bionic-security)
- Recommended updates (bionic-updates)
For this purpose, it doesn't matter much whether or not the "Unsupported updates" box is checked. Most users will generally prefer not to enable that repository.
You may need to enter a password to change those settings. That's normal.
Click Close.
You will be told, "The information about available software is out-of-date." Click Reload.
You should now be able to install the linux-tools-4.18.0-21-generic
package. Go ahead and attempt to do so.
Manually, by editing /etc/apt/sources.list
If you have no GUI or prefer to manually edit /etc/apt/sources.list
, you can do so. Normally I would recommend backing up the file you have, but what you have doesn't contain very much. Still, if you want to you can do so by running sudo cp /etc/apt/sources.list{,.bak}
. You can then edit the file. It's owned by root; I suggest editing it with sudoedit
. You can run:
sudoedit /etc/apt/sources.list
If you have a specific editor you prefer sudoedit
to use, you can specify that. For example, to use nano
even if that's not the default, you could run this instead:
VISUAL=nano sudoedit /etc/apt/sources.list
After editing, the contents of your /etc/apt/sources.list
file should look like:
deb http://archive.ubuntu.com/ubuntu bionic main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu bionic main universe restricted multiverse
deb http://archive.ubuntu.com/ubuntu bionic-updates main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu bionic-updates main universe restricted multiverse
deb http://security.ubuntu.com/ubuntu/ bionic-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu/ bionic-security main universe restricted multiverse
The lines that start with deb-src
provide source code packages. Including them may make sudo apt update
take slightly longer each time it is run, but does not incur any other significant overhead. Still, if you don't want to able to download source code automatically through the package manager, you can comment them out (by placing a #
at the beginning of each line you wish to deactivate) or even omit them. You can (re)enable them later.
You may want to use a mirror instead of the master site, to get faster downloads. For example, the main US mirror would be used if you wrote us.archive.ubuntu.com
instead of archive.ubuntu.com
. Your current deb
and deb-src
lines don't use one, so I didn't either in what I wrote above. I mainly mention this to point out that if you do decide to use one, you should still keep the URLs in the http://security.ubuntu.com/ubuntu/
lines unchanged.
cat /etc/apt/sources.list
shows you don't have either of the repositories that provide updated software enabled. I've posted an answer. – Eliah Kagan Jul 03 '19 at 05:47