Java教程

Ubuntu换源后代号不匹配引发的问题

本文主要是介绍Ubuntu换源后代号不匹配引发的问题,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

  最近尝试使用WSL,在换完国内源的后,配置需要的开发环境是出现了下面的问题:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libtool : Depends: libc6-dev but it is not going to be installed or
                    libc-dev
           Recommends: libltdl-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

  然后查找发现是换的国内源的代号与当前版本Ubuntu版本不匹配导致的问题,当前安装的是20.04版本,却使用了18.04版本配置的源。通过下面的指令查看系统版本

lsb_release -a

  版本如下,版本Codename: focal

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal

  此时使用的国内源的配置为:

deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/bionic-backports main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

  更换后的源的的配置为

deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse

  两者区别很小就是bionic和focal这个地方不一样,但是如果配置不对会引发一系列的问题。

  换完源后更新一下

sudo apt-get update
sudo apt-get upgrade

  这时候再次配置开发环境正常配置完成无报错

  遇到问题做一个总结,如果有错误的地方,望指正

 

这篇关于Ubuntu换源后代号不匹配引发的问题的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!