search
LoginSignup
0

More than 1 year has passed since last update.

posted at

apt upgradeでエラー吐いた時の対処(備忘録)

$ sudo apt update
$ sudo apt upgrade

を実行したところ次のようなエラーが出た。

$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... 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:
 distro-info-data : Breaks: distro-info (< 0.20~) but 0.18ubuntu0.18.04.1 is to be installed
 dpkg : Breaks: libapt-pkg5.0 (< 1.7~b) but 1.6.13 is to be installed
E: Broken packages

とりあえず何がupgradeできなかったのかを見る。

$ apt list --upgradable
Listing... Done
ubuntu-advantage-tools/bionic-updates 27.0.2~18.04.1 amd64 [upgradable from: 20.3]
N: There are 2 additional versions. Please use the '-a' switch to see them.

どうやらubuntu-advantage-toolsなるものがupgradeに失敗したっぽい。
調べたところ、removeしても問題なさそうなので、

$ sudo apt remove ubuntu-advantage-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  ubuntu-advantage-tools ubuntu-minimal
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 275 kB disk space will be freed.
Do you want to continue? [Y/n] y
dpkg: warning: files list file for package 'ubuntu-advantage-tools' missing; assuming package has no files currently installed
(Reading database ... 90724 files and directories currently installed.)
Removing ubuntu-minimal (1.450.2) ...
Removing ubuntu-advantage-tools (20.3) ...

再度update

$ sudo apt update
Hit:1 http://jp.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://jp.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Hit:3 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease
Get:4 http://jp.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Fetched 252 kB in 2s (123 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
0