参考链接:
[解决 The following packages have unmet dependencies: 问题] https://blog.csdn.net/jqw11/article/details/93063985
[ubuntu更改镜像源(软件源)] https://blog.csdn.net/qq_28193019/article/details/89352824
[Ubuntu | 镜像使用帮助 | 清华大学开源软件镜像站] https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
[vim_8.0.1453-1ubuntu1.3_amd64.deb 安装链接]
https://ubuntu.pkgs.org/18.04/ubuntu-updates-main-amd64/vim_8.0.1453-1ubuntu1.3_amd64.deb.html
更新:
Ubuntu18.04继续安装Vim会莫名其妙地报错,升级到Ubuntu20.04,在更改清华镜像源以后,再安装Vim又没有报错了。
Step1: 更改镜像源
ploso@ploso-ThinkPad-T420:~$ sudo apt-get update
[sudo] password for ploso:
Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease [242 kB]
Get:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security InRelease [88.7 kB]
Get:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main amd64 Packages [1,019 kB]
Get:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main i386 Packages [1,007 kB]
Get:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main Translation-en [516 kB]
Get:8 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main amd64 DEP-11 Metadata [477 kB]
Get:9 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main DEP-11 48x48 Icons [118 kB]
Get:10 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main DEP-11 64x64 Icons [245 kB]
Get:11 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/restricted i386 Packages [9,156 B]
Get:12 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/restricted amd64 Packages [9,184 B]
Get:13 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/restricted Translation-en [3,584 B]
Get:14 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/universe i386 Packages [8,531 kB]
Get:15 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/universe amd64 Packages [8,570 kB]
Get:16 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/universe Translation-en [4,941 kB]
Get:17 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/universe amd64 DEP-11 Metadata [3,287 kB]
Get:18 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/universe DEP-11 48x48 Icons [2,151 kB]
Get:19 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/universe DEP-11 64x64 Icons [8,420 kB]
Get:20 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/multiverse i386 Packages [144 kB]
Get:21 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/multiverse amd64 Packages [151 kB]
Get:22 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/multiverse Translation-en [108 kB]
Get:23 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/multiverse amd64 DEP-11 Metadata [49.7 kB]
Get:24 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/multiverse DEP-11 48x48 Icons [8,931 B]
Get:25 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/multiverse DEP-11 64x64 Icons [225 kB]
Get:26 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main i386 Packages [748 kB]
Get:27 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main amd64 Packages [1,089 kB]
Get:28 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main Translation-en [360 kB]
Get:29 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main amd64 DEP-11 Metadata [295 kB]
Get:30 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main DEP-11 48x48 Icons [81.9 kB]
Get:31 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main DEP-11 64x64 Icons [157 kB]
Get:32 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/restricted amd64 Packages [107 kB]
Get:33 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/restricted i386 Packages [12.0 kB]
Get:34 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/restricted Translation-en [23.0 kB]
Get:35 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/universe amd64 Packages [1,113 kB]
Get:36 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/universe i386 Packages [1,034 kB]
Get:37 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/universe Translation-en [348 kB]
Get:38 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [285 kB]
Get:39 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/universe DEP-11 48x48 Icons [214 kB]
Get:40 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/universe DEP-11 64x64 Icons [464 kB]
Get:41 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/multiverse i386 Packages [9,432 B]
Get:42 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/multiverse amd64 Packages [21.7 kB]
Get:43 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/multiverse Translation-en [6,920 B]
Get:44 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,468 B]
Get:45 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/multiverse DEP-11 48x48 Icons [29 B]
Get:46 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/multiverse DEP-11 64x64 Icons [2,638 B]
Get:47 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/main i386 Packages [7,508 B]
Get:48 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/main amd64 Packages [7,516 B]
Get:49 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/main Translation-en [4,764 B]
Get:50 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/universe i386 Packages [7,724 B]
Get:51 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/universe amd64 Packages [7,736 B]
Get:52 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/universe Translation-en [4,588 B]
Get:53 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [9,288 B]
Get:54 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/universe DEP-11 48x48 Icons [2,809 B]
Get:55 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/universe DEP-11 64x64 Icons [3,943 B]
Get:56 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/main i386 Packages [545 kB]
Get:57 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/main amd64 Packages [868 kB]
Get:58 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/main Translation-en [269 kB]
Get:59 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/main amd64 DEP-11 Metadata [48.9 kB]
Get:60 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/main DEP-11 48x48 Icons [28.4 kB]
Get:61 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/main DEP-11 64x64 Icons [62.4 kB]
Get:62 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/restricted amd64 Packages [95.5 kB]
Get:63 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/restricted i386 Packages [6,412 B]
Get:64 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/restricted Translation-en [20.4 kB]
Get:65 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/universe i386 Packages [642 kB]
Get:66 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/universe amd64 Packages [708 kB]
Get:67 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/universe Translation-en [236 kB]
Get:68 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/universe amd64 DEP-11 Metadata [56.0 kB]
Get:69 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/universe DEP-11 48x48 Icons [19.8 kB]
Get:70 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/universe DEP-11 64x64 Icons [109 kB]
Get:71 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/multiverse amd64 Packages [8,512 B]
Get:72 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/multiverse i386 Packages [3,884 B]
Get:73 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/multiverse Translation-en [2,908 B]
Get:74 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:75 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/multiverse DEP-11 48x48 Icons [29 B]
Get:76 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/multiverse DEP-11 64x64 Icons [2,638 B]
Fetched 50.7 MB in 17s (3,019 kB/s)
Reading package lists... Done
Step2: 安装 Vim
ploso@ploso-ThinkPad-T420:~$ sudo apt-get install vim
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:
vim : Depends: vim-common (= 2:8.0.1453-1ubuntu1.3) but 2:8.0.1766-1ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.
ploso@ploso-ThinkPad-T420:~$ sudo apt-get install vim-common=2:9.0.1453-1ubuntu1.3
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '2:9.0.1453-1ubuntu1.3' for 'vim-common' was not found
ploso@ploso-ThinkPad-T420:~$ sudo apt-get install vim-common=2:8.0.1453-1ubuntu1.3
Reading package lists... Done
Building dependency tree
Reading state information... Done
Recommended packages:
vim | vim-gtk | vim-gtk3 | vim-athena | vim-nox | vim-tiny
The following packages will be REMOVED:
ubuntu-minimal vim-tiny
The following packages will be DOWNGRADED:
vim-common
0 upgraded, 0 newly installed, 1 downgraded, 2 to remove and 133 not upgraded.
Need to get 70.6 kB of archives.
After this operation, 1,425 kB disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main amd64 vim-common all 2:8.0.1453-1ubuntu1.3 [70.6 kB]
Fetched 70.6 kB in 0s (179 kB/s)
(Reading database ... 130363 files and directories currently installed.)
Removing ubuntu-minimal (1.425) ...
Removing vim-tiny (2:8.0.1766-1ubuntu1) ...
dpkg: warning: downgrading vim-common from 2:8.0.1766-1ubuntu1 to 2:8.0.1453-1ubuntu1.3
(Reading database ... 130347 files and directories currently installed.)
Preparing to unpack .../vim-common_2%3a8.0.1453-1ubuntu1.3_all.deb ...
Unpacking vim-common (2:8.0.1453-1ubuntu1.3) over (2:8.0.1766-1ubuntu1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-3ubuntu2) ...
Setting up vim-common (2:8.0.1453-1ubuntu1.3) ...
Processing triggers for man-db (2.8.4-2) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu2) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
ploso@ploso-ThinkPad-T420:~$ sudo apt-get install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
vim-runtime
Suggested packages:
ctags vim-doc vim-scripts
The following NEW packages will be installed:
vim vim-runtime
0 upgraded, 2 newly installed, 0 to remove and 133 not upgraded.
Need to get 6,589 kB of archives.
After this operation, 32.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main amd64 vim-runtime all 2:8.0.1453-1ubuntu1.3 [5,436 kB]
Get:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main amd64 vim amd64 2:8.0.1453-1ubuntu1.3 [1,153 kB]
Fetched 6,589 kB in 3s (2,134 kB/s)
Selecting previously unselected package vim-runtime.
(Reading database ... 130347 files and directories currently installed.)
Preparing to unpack .../vim-runtime_2%3a8.0.1453-1ubuntu1.3_all.deb ...
Adding 'diversion of /usr/share/vim/vim80/doc/help.txt to /usr/share/vim/vim80/doc/help.txt.vim-tiny by vim-runtime'
Adding 'diversion of /usr/share/vim/vim80/doc/tags to /usr/share/vim/vim80/doc/tags.vim-tiny by vim-runtime'
Unpacking vim-runtime (2:8.0.1453-1ubuntu1.3) ...
Selecting previously unselected package vim.
Preparing to unpack .../vim_2%3a8.0.1453-1ubuntu1.3_amd64.deb ...
Unpacking vim (2:8.0.1453-1ubuntu1.3) ...
Processing triggers for man-db (2.8.4-2) ...
Setting up vim-runtime (2:8.0.1453-1ubuntu1.3) ...
Setting up vim (2:8.0.1453-1ubuntu1.3) ...
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode
ploso@ploso-ThinkPad-T420:~$