“sudo apt-get upgrade”在 Ubuntu 18.04 WSL 上不起作用

“sudo apt-get upgrade”在 Ubuntu 18.04 WSL 上不起作用

我尝试在 WSL 中将 Ubuntu 18.04 LTS 升级到 20.04 LTS(可能在 WSL 可用之前),但升级失败。尝试之后,我无法升级任何软件包,原因sudo apt-get upgrade是依赖项未满足问题。我尝试了网上的许多可能的解决方案,但都不起作用。

请告诉我如何解决这个问题。

(据我理解,WSL 已部分升级到 Ubuntu 20.04,并且没有像在 Ubuntu 18.04 中那样将更改的软件包降级。所以也许降级提到的 2 个软件包应该是可行的。)

问题如下:

(base) sambit98@A-K-MISHRA:/mnt/d/SAMBIT/UBUNTU$ sudo apt-get update
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [89.1 kB]
Hit:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Fetched 89.1 kB in 3s (34.5 kB/s)
Reading package lists... Done
(base) sambit98@A-K-MISHRA:/mnt/d/SAMBIT/UBUNTU$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libc-bin : Depends: libc6 (< 2.28) but 2.31-0ubuntu9 is installed
 locales : Depends: libc-bin (> 2.31) but 2.27-3ubuntu1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
(base) sambit98@A-K-MISHRA:/mnt/d/SAMBIT/UBUNTU$ 

以下是我目前的系统规格(如果需要):

(base) sambit98@A-K-MISHRA:/mnt/d/SAMBIT/UBUNTU$ lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              8
On-line CPU(s) list: 0-7
Thread(s) per core:  2
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               142
Model name:          Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Stepping:            10
CPU MHz:             2001.000
CPU max MHz:         2001.0000
BogoMIPS:            4002.00
Virtualization:      VT-x
Hypervisor vendor:   Windows Subsystem for Linux
Virtualization type: container
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave osxsave avx f16c rdrand lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt ibrs ibpb stibp ssbd

编辑 1:我在 Windows 10 版本 1909(OS Build 18363.815)上使用 WSL 版本 1。

答案1

https://www.how2shout.com/how-to/how-to-upgrade-ubuntu-18-04-lts-to-20-04-lts-on-wsl-windows-10.html给出了解决问题的有用步骤,尽管你可能必须像我一样取消保留一些包裹:

这些是我运行的命令:

wget https://launchpad.net/~rafaeldtinoco/+archive/ubuntu/lp1871129/+files/libc6_2.31-0ubuntu8+lp1871129~1_amd64.deb
dpkg --install libc6_2.31-0ubuntu8+lp1871129~1_amd64.deb
apt-mark hold libc6
apt-mark unhold libc6-bin
apt --fix-broken install
apt full-upgrade

而且它似乎正在顺利升级。

相关内容