How to fix "unable to locate package" for apt-get on Debian?

Viewed 6351

I'm trying to download/install packages on Debian 10 WSL, but I get an error:

sudo apt-get install cmake
[sudo] password for admin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package cmake

I checked the sources.list file, and this is what it looks like:

deb http://deb.debian.org/debian buster main
deb http://deb.debian.org/debian buster-updates main
deb http://security.debian.org/debian-security/ buster/updates main
deb http://ftp.debian.org/debian buster-backports main

I notice that I'm not allowed to modify this document even though I've run my text editor in administrative mode: I get an error that the file is open in another program when it visibly isn't.

Taking a look at the docs and I've compared my one to the sample:

deb http://deb.debian.org/debian buster main
deb-src http://deb.debian.org/debian buster main

deb http://deb.debian.org/debian-security/ buster/updates main
deb-src http://deb.debian.org/debian-security/ buster/updates main

deb http://deb.debian.org/debian buster-updates main
deb-src http://deb.debian.org/debian buster-updates main

Is it fine to not have deb-src in my sources.list? I would try and modify the file, but I'm not allowed to.

Update: Doing apt-get update solved the "unable to locate package" problem.

0 Answers
Related