do-release 升级失败,出现 KeyError:“缓存中没有名为‘ubuntu-minimal’的包”

do-release 升级失败,出现 KeyError:“缓存中没有名为‘ubuntu-minimal’的包”

我正在尝试将 ubuntu 服务器从 16.04 升级到 18.04,do-release-upgrade但一开始就出现错误:

Traceback (most recent call last): 

File "/tmp/ubuntu-release-upgrader-074vyz42/bionic", line 8, in 
<module> 
sys.exit(main()) 

File 
"/tmp/ubuntu-release-upgrader-074vyz42/DistUpgrade/DistUpgradeMain.py", 
line 238, in main 
if app.run(): 

File 
"/tmp/ubuntu-release-upgrader-074vyz42/DistUpgrade/DistUpgradeController.py", 
line 2053, in run 
return self.fullUpgrade() 

File 
"/tmp/ubuntu-release-upgrader-074vyz42/DistUpgrade/DistUpgradeController.py", 
line 1936, in fullUpgrade 
if not self.cache.anyVersionDownloadable(self.cache[pkg]): 

File "/usr/lib/python3/dist-packages/apt/cache.py", line 233, in 
__getitem__ 
raise KeyError('The cache has no package named %r' % key) 

KeyError: "The cache has no package named 'ubuntu-minimal'" 

它看起来像这个错误,但是这个错误报告是几个月前的,并没有引起任何关注。https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1795207

ubuntu-minimal 既未卸载也不可用:

root@tooticky:~# apt install ubuntu-minimal
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package ubuntu-minimal

答案1

我遇到了同样的问题。我的解决方案是清除所有缓存的软件包,然后再尝试更新。sudo rm -rf /var/lib/apt/lists/*然后sudo apt-get update对我有用。更新后,您可以使用检查 Ubuntu 的版本lsb_release -a

相关内容