系统相关
首页 > 系统相关> > 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

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

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

 

标签:cn,universe,restricted,Ubuntu,换源,edu,main,代号,ubuntu
来源: https://www.cnblogs.com/rangerschen/p/15858731.html