LoginSignup
1
0

More than 1 year has passed since last update.

[Debian / Ubuntu / Docker] debian:jessieからdebian:busterに移行したら"E: Unable to locate package xxxxxxx"の巻

Last updated at Posted at 2021-07-06

Target(想定読者)

記事タイトルの条件のほかに、

  • rubyをdebian系のLinux上で動かしている

という条件も満たす方におそらく役に立つと思われます。

Summary(概要)

Dockerfileでdebian:jessieというイメージが指定されていた。
あまりにも古くて問題になったのでdebian:busterに変えたところ、次のエラーが出た。

$ apt-get install libgdbm3
E: Unable to locate package libgdbm3
$ apt-get install libmysqlclient-dev
E: Unable to locate package libmysqlclient-dev

一応、Dockerとは全く関係ない問題です。
あくまでも、Debian/Linuxの問題。

Solution(対策)

# old
# apt-get install libgdbm3

# new
$ apt-get install libgmp-dev
# old
# apt-get install libmysqlclient-dev

# new
$ apt-get install default-libmysqlclient-dev

これで解決した。
今日3時間近くかかってる。

仮想敵「修正したのたった2行っすよ...どうなってんすかsiruku6さん、、、、さぼってたんすか....」
siruku6「日本語の記事が、全然なかったんですよ!!!!」_(-ω-`_)⌒)_グッタリ

Note(補足)

note1: libgmp3-devだとダメかも?

むっちゃ色々頑張ってると、bundle install中にこんなエラーが出ることもある。
gem raccのインストールに失敗しているのだが....

Fetching racc 1.5.2
Installing racc 1.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/myuser2/.gem/ruby/2.7.0/gems/racc-1.5.2/ext/racc/cparse
/opt/local/bin/ruby2.7 -I /opt/local/lib/ruby2.7/2.7.0 -r
./siteconf20210104-30183-axgzet.rb extconf.rb
checking for rb_ary_subseq()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
       --with-opt-dir
       --with-opt-include
       --without-opt-include=${opt-dir}/include
       --with-opt-lib
       --without-opt-lib=${opt-dir}/lib
       --with-make-prog
       --without-make-prog
       --srcdir=.
       --curdir
       --ruby=/opt/local/bin/$(RUBY_BASE_NAME)2.7
/opt/local/lib/ruby2.7/2.7.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:564:in `try_link0'
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:582:in `try_link'
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:794:in `try_func'
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:1083:in `block in have_func'
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:971:in `block in checking_for'
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:361:in `block (2 levels) in postpone'
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:331:in `open'
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:361:in `block in postpone'
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:331:in `open'
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:357:in `postpone'
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:970:in `checking_for'
       from /opt/local/lib/ruby2.7/2.7.0/mkmf.rb:1082:in `have_func'
       from extconf.rb:6:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/Users/myuser2/.gem/ruby/2.7.0/extensions/arm64-darwin-20/2.7.0/racc-1.5.2/mkmf.log

その原因は、libgdbm3をインストールしなくなったためであった。
このとき、libgdbm3の代わりにlibgmp3-devをインストールしたのだが、それではダメだった。(気がする)
libgmp-devをインストールしなければならなかった。

ただ、このnote1が解決しなかったのは、note2の問題のせいという可能性があるので、正直自信がない。

次のnote2については、確実にエラーの解消に繋がったのを確認できたので、是非note2もチェックされたい。

note2: libgmp-devの位置

もう一個注意。

Dockerfileの中で、何回もapt-get installが書かれていることってありますよね?
その時に、libgmp-devを結構後ろの方のapt-get installに混ぜてしまったんですが、そのときはnote1のエラーが解消しませんでした。

libgmp-devを、一番最初のapt-get installの中に混ぜてあげたら、エラーが解消した。

なんなんですか.....。。

note3: gnupg

難しくなかったので、書かなくてもわかるかと思って省略してましたが、
gnupgapt-get installしてあげる必要がありました。
参考まで。

Resouces(情報元)

1
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
1
0