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

nao*_*omi 4 linux ubuntu

我正在尝试使用以下方法将 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'" 
Run Code Online (Sandbox Code Playgroud)

貌似是这个bug,但是bug报告是几个月前的,还没有人关注。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
Run Code Online (Sandbox Code Playgroud)

小智 5

我遇到了同样的问题。我的解决方案是在尝试再次更新之前清除所有缓存的包。sudo rm -rf /var/lib/apt/lists/*其次是sudo apt-get update为我工作。更新后,您可以使用lsb_release -a.