Ubuntu 14安装git与openssh-client报错:依赖包损坏、无安装候选
Hey there, let's work through this issue together. Those errors you're seeing are super common on Ubuntu 14.04 these days, and it mostly comes down to the fact that Ubuntu 14.04 reached its end-of-life (EOL) years ago—meaning the default package repositories are no longer active. Here's a step-by-step fix:
Step 1: Resolve Existing Package Issues
First, let's clean up and fix any broken dependencies or held packages that might be blocking installs:
- Clear out cached packages that could be corrupted:
sudo apt-get clean sudo apt-get autoclean - Force-fix any unmet dependencies in your system:
sudo apt-get -f install - Check if any packages are marked as "held" (this locks them and prevents updates/installs):
If you see packages listed here, unhold them with:sudo apt-mark showhold
Replacesudo apt-mark unhold <package-name><package-name>with the actual package from the output.
Step 2: Switch to Ubuntu's Old Releases Repository
Since Ubuntu 14.04 is no longer supported, we need to point your system to the archived repositories that still host its packages:
- First, back up your current sources list (a safety net in case something goes wrong):
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak - Update all repository URLs to use the old releases server. You can do this quickly with a sed command:
Alternatively, edit the file manually withsudo sed -i 's/archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list sudo sed -i 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.listsudo nano /etc/apt/sources.listand replace every instance ofarchive.ubuntu.comorsecurity.ubuntu.comwithold-releases.ubuntu.com. - Refresh your package cache with the updated sources:
sudo apt-get update
Step 3: Install Git & OpenSSH-Client
Now that your repositories are working again, try installing the packages you need:
- Install Git:
sudo apt-get install git - Install OpenSSH-Client:
sudo apt-get install openssh-client
If You Still Run Into Issues
If the errors persist, try these extra troubleshooting steps:
- Force-configure any partially installed packages that might be stuck:
sudo dpkg --configure -a - Temporarily disable any third-party repositories you've added (check the
/etc/apt/sources.list.d/directory) and runsudo apt-get updateagain before attempting the install.
内容的提问来源于stack exchange,提问作者فاطمه الطاهر

