I just installed a headless Debian on my first that I'v ever built but I can't install any packages on it.

root@media-server:~# apt-get install vim
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package vim is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'vim' has no installation candidate

I get the same thing with pretty much any package I try to install. I have also already ran apt-get update
Any ideas? Thanks.

Dani AI

Generated

Short diagnosis and why ’s PPA suggestion didn’t help: that apt error normally means the package name is known to APT but there’s no candidate in any enabled repository on that machine — in other words, your apt sources don’t include a repository that contains the package. PPAs are an Ubuntu/Launchpad feature and are not the usual fix on Debian; installing add-apt-repository only helps if upstream repos are already reachable. (askubuntu.com)

Quick, low-risk checks to run on the headless server (do these as root or with sudo):

apt-cache policy vim
cat /etc/apt/sources.list
ls -l /etc/apt/sources.list.d/

apt-cache policy shows whether a candidate version exists and which repository would provide it; the contents of /etc/apt/* show which archives apt is allowed to use. If the policy shows “Candidate: (none)” or your sources contain only a CD-ROM or security-only lines, that explains the error. (manpages.debian.org)

If repositories are missing, add the main Debian archive (use your release codename or the stable alias) and the security/updates lines. Example (edit files under /etc/apt/ safely):

deb http://deb.debian.org/debian stable main contrib non-free
deb http://security.debian.org/debian-security stable-security main contrib non-free
deb http://deb.debian.org/debian stable-updates main contrib non-free

After adding the correct lines, refresh APT’s lists and retry. See the Debian sources.list guidance for the exact format and options. (wiki.debian.org)

Notes specific to things already tried by and : the add-apt-repository helper is provided by the software-properties package on Debian — software-properties-common (older releases used python-software-properties) — but that package itself won’t install if the main repo is missing, so fix sources first. Also check architecture mismatches on minimal/custom images with dpkg --print-architecture. If the installation came from a netinst/CD image, it’s common for only CD lines to be present; switch to network mirrors for normal package installs. (packages.debian.org)

If those checks don’t reveal the problem, paste the output of apt-cache policy vim and a sanitized /etc/apt/sources.list (remove any sensitive keys/credentials) so the next steps can be precise.

Recommended Answers

All 4 Replies

sudo add-apt-repository ppa:nmi/vim-snapshots
sudo apt-add-repository ppa:passy/vim
sudo apt-get update
sudo apt-get upgrade

There has been somebody who had already one version of Vim, and there was newer one which he/she couldn't find on his/her repository. This solved his/her issue, maybe it could solve yours.

root@media-server:~# add-apt-repository ppa:nmi/vim-snapshots
-su: add-apt-repository: command not found
root@media-server:~# apt-add-repository ppa:passy/vim
-su: apt-add-repository: command not found
sudo apt-get install python-software-properties

If this won't work

sudo nano /etc/apt/sources.list

And edit manually :)

Edit it manually to say what. The python thing didn't work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.