0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【WSL2】ubuntu20.04にgitをインストールする際のエラーとその解決方法

Last updated at Posted at 2023-05-05

概要

WLS2の Ubuntu 20.04 環境に git をインストールしようとするとライブラリ不足のエラーが発生したので、解決に使ったコマンドを残しておきます。

・発生したエラー

$ sudo apt install -y git
[sudo] password for docker-user:
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:
 code : Depends: libatk-bridge2.0-0 (>= 2.5.3) but it is not going to be installed
        Depends: libatk1.0-0 (>= 2.2.0) but it is not going to be installed
        Depends: libatspi2.0-0 (>= 2.9.90) but it is not going to be installed
        Depends: libcairo2 (>= 1.6.0) but it is not going to be installed
        Depends: libgbm1 (>= 17.1.0~rc2) but it is not going to be installed
        Depends: libgtk-3-0 (>= 3.9.10) but it is not going to be installed
        Depends: libgtk-3-0 (>= 3.9.10) but it is not going to be installed or
                 libgtk-4-1 but it is not installable
        Depends: libpango-1.0-0 (>= 1.14.0) but it is not going to be installed
        Depends: libsecret-1-0 (>= 0.18) but it is not going to be installed
        Depends: libxdamage1 (>= 1:1.1) but it is not going to be installed
        Depends: libxkbcommon0 (>= 0.4.1) but it is not going to be installed
        Depends: xdg-utils (>= 1.0.2) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

解決方法

警告されているように sudo apt --fix-broken install を実行して下さい

$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  adwaita-icon-theme at-spi2-core cpp cpp-9 fontconfig gcc-9-base gtk-update-icon-cache hicolor-icon-theme
  humanity-icon-theme libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libauthen-sasl-perl libavahi-client3
  libavahi-common-data libavahi-common3 libcairo-gobject2 libcairo2 libcolord2 libcups2 libdata-
・
・
中略
・
・
Setting up libgtk-3-bin (3.24.20-0ubuntu1.1) ...
Setting up code (1.78.0-1683145611) ...
Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.40.0+dfsg-3ubuntu0.4) ...
$

再度gitをインストール

警告されているように sudo apt --fix-broken install を実行して下さい

$ sudo apt install -y git
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn
The following packages will be upgraded:
  git
1 upgraded, 0 newly installed, 0 to remove and 191 not upgraded.
Need to get 4605 kB of archives.
After this operation, 303 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 git amd64 1:2.25.1-1ubuntu3.11 [4605 kB]
Fetched 4605 kB in 3s (1517 kB/s)
(Reading database ... 48850 files and directories currently installed.)
Preparing to unpack .../git_1%3a2.25.1-1ubuntu3.11_amd64.deb ...
Unpacking git (1:2.25.1-1ubuntu3.11) over (1:2.25.1-1ubuntu3.2) ...
Setting up git (1:2.25.1-1ubuntu3.11) ...
$ git --version
git version 2.25.1
$
0
0
0

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
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?