LoginSignup
0
1

More than 1 year has passed since last update.

CentOS8でalienをインストールしたかったけどうまくいかなかった

Posted at

alienとは

Alien is a program that converts between the rpm, dpkg, stampede slp, and slackware tgz file formats.

alienのwebページでは上記のように説明されていますが、RedHat系OSのパッケージ形式であるRPMからDebian系OSのパッケージ形式であるdebに変換(逆も可能)するツールです。

alienを使うとパッケージの変換が可能ではありますが、複雑な依存関係から構成されるパッケージ(例えばwebサーバのApacheとか)を変換しても、様々な問題が発生して思うようにインストールできなかったり、インストールできても動作しなかったりします。

依存関係がなく、単一ファイルでインストール可能なパッケージだったり、複数のファイル群を1ファイルに固めただけのお手製パッケージであれば、alienでの変換に向いてるのではないでしょうか。

CentOS8でalienをインストールしてみる

それではタイトルのとおり、インストールに失敗した作業履歴を見ていきましょう。

まず dnf コマンドで alien を検索してみると、該当パッケージが見つかりません。

$ dnf search alien 
Last metadata expiration check: 0:14:42 ago on Tue Aug 10 12:03:51 2021.
No matches found.

EPELのwebページの「Alternately, you can browse the package set」からたどると alien のパッケージはEPELリポジトリに含まれていることがわかりました。

なので、まずは epel-release をインストールします。

$ sudo dnf install epel-release -y

再度 dnf コマンドで検索してみると今度は該当パッケージが見つかりました。
楽勝じゃん。と、この時点では思ってました。

$ dnf search alien 
Extra Packages for Enterprise Linux Modular 8 - 211 kB/s | 927 kB     00:04    
Extra Packages for Enterprise Linux 8 - x86_64  852 kB/s |  10 MB     00:12    
Last metadata expiration check: 0:00:01 ago on Tue Aug 10 12:37:12 2021.
========================= Name Exactly Matched: alien ==========================
alien.noarch : Converter between the rpm, dpkg, stampede slp, and Slackware tgz
             : file formats

インストールコマンドを実行すると、以下のようなエラーが表示されました。
alien をインストールするには debhelper が必要で
debhelper をインストールするには dpkg-perl が必要で
dpkg-perl をインストールするには perl-Digest-SHA が必要である、といった内容に見えます。
そして、リクエストが競合しています、とのこと。なんだかよくわかりません。

$ sudo dnf install alien -y
Last metadata expiration check: 0:00:30 ago on Tue Aug 10 12:38:13 2021.
Error: 
 Problem: package alien-8.95-14.el8.noarch requires debhelper, but none of the providers can be installed
  - package debhelper-12.7.3-2.el8.noarch requires perl(Dpkg::BuildProfiles), but none of the providers can be installed
  - package debhelper-12.7.3-2.el8.noarch requires dpkg-perl >= 1.17.14, but none of the providers can be installed
  - conflicting requests
  - nothing provides perl(Digest::SHA1) needed by dpkg-perl-1.18.25-12.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

エラーメッセージ内に登場しているパッケージがインストールされているか確認してみると perl-Digest-SHA 以外はインストールされていないことがわかりました。
これまでの経験を踏まえると needed by と表示されていて、既にインストール済みの場合はだいたいバージョンの問題である可能性が高いです。

$ rpm -q debhelper       
package debhelper is not installed
$ rpm -q dpkg-perl
package dpkg-perl is not installed
$ rpm -q perl-Digest-SHA
perl-Digest-SHA-6.02-1.el8.x86_64

debhelper のインストールを試みると同じようなエラーメッセージが表示されました。

$ sudo dnf install debhelper -y
Last metadata expiration check: 0:13:06 ago on Tue Aug 10 12:38:13 2021.
Error: 
 Problem: package debhelper-12.7.3-2.el8.noarch requires perl(Dpkg::BuildProfiles), but none of the providers can be installed
  - package debhelper-12.7.3-2.el8.noarch requires dpkg-perl >= 1.17.14, but none of the providers can be installed
  - conflicting requests
  - nothing provides perl(Digest::SHA1) needed by dpkg-perl-1.18.25-12.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

dpkg-perl も同様です。

$ sudo dnf install dpkg-perl -y
Last metadata expiration check: 0:14:02 ago on Tue Aug 10 12:38:13 2021.
Error: 
 Problem: conflicting requests
  - nothing provides perl(Digest::SHA1) needed by dpkg-perl-1.18.25-12.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

perl-Digest-SHA については最新のパッケージがインストールされているようです。

$ sudo dnf update perl-Digest-SHA
Last metadata expiration check: 0:14:41 ago on Tue Aug 10 12:38:13 2021.
Dependencies resolved.
Nothing to do.
Complete!

一体どうしろと。

dnf コマンドではインストールできなさそうなので、EPELのページから alien のRPMパッケージのURLを特定して、直接ダウンロードしたものを rpm コマンドでインストールしてみました。
すると、 dnf コマンドの際とは異なるエラーメッセージが表示されました。
debhelper の他に dpkgrpm-build が必要らしいです。というかRedHat系OSに dpkg コマンドってあるんですね。知らなくてちょっとビックリしました。

$ curl -sLO https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel/8/Everything/x86_64/Packages/a/alien-8.95-14.el8.noarch.rpm
$ sudo rpm -ivh alien-8.95-14.el8.noarch.rpm 
warning: alien-8.95-14.el8.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 2f86d6a1: NOKEY
error: Failed dependencies:
    debhelper is needed by alien-8.95-14.el8.noarch
    dpkg is needed by alien-8.95-14.el8.noarch
    rpm-build is needed by alien-8.95-14.el8.noarch

エラーメッセージに従って dpkgrpm-build をインストールしてみます。

$ sudo dnf install dpkg rpm-build -y

dnf コマンドでもう一度 alien のインストールを試みましたが結果は変わらずです。

$ sudo dnf install alien -y
Last metadata expiration check: 0:02:07 ago on Tue Aug 10 13:02:10 2021.
Error: 
 Problem: package alien-8.95-14.el8.noarch requires debhelper, but none of the providers can be installed
  - package debhelper-12.7.3-2.el8.noarch requires perl(Dpkg::BuildProfiles), but none of the providers can be installed
  - package debhelper-12.7.3-2.el8.noarch requires dpkg-perl >= 1.17.14, but none of the providers can be installed
  - conflicting requests
  - nothing provides perl(Digest::SHA1) needed by dpkg-perl-1.18.25-12.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

試しに --skip-broken をつけてみるとインストールが空振りました。

$ sudo dnf install alien -y --skip-broken 
Last metadata expiration check: 0:03:07 ago on Tue Aug 10 13:02:10 2021.
Dependencies resolved.
Nothing to do.
Complete!

--nobest をつけて試してみましたが結果は変わらず。

$ sudo dnf install alien -y --nobest
Last metadata expiration check: 0:04:02 ago on Tue Aug 10 13:02:10 2021.
Error: 
 Problem: package alien-8.95-14.el8.noarch requires debhelper, but none of the providers can be installed
  - package debhelper-12.7.3-2.el8.noarch requires perl(Dpkg::BuildProfiles), but none of the providers can be installed
  - package debhelper-12.7.3-2.el8.noarch requires dpkg-perl >= 1.17.14, but none of the providers can be installed
  - conflicting requests
  - nothing provides perl(Digest::SHA1) needed by dpkg-perl-1.18.25-12.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages)

ダウンロードしておいたRPMパッケージを個別にインストールしてみると、やっぱり debhelper が必要とのこと。そりゃそうです。

$ sudo rpm -ivh alien-8.95-14.el8.noarch.rpm 
error: Failed dependencies:
    debhelper is needed by alien-8.95-14.el8.noarch

debhelper も個別にダウンロードして alien と一緒にインストールしてみようとすると、エラーの情報が増えてしまいました。

$ curl -sLO https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel/8/Everything/x86_64/Packages/d/debhelper-12.7.3-2.el8.noarch.rpm
$ sudo rpm -ivh debhelper-12.7.3-2.el8.noarch.rpm \
> alien-8.95-14.el8.noarch.rpm 
error: Failed dependencies:
    dh-autoreconf >= 17 is needed by debhelper-12.7.3-2.el8.noarch
    dpkg-dev >= 1.18.2 is needed by debhelper-12.7.3-2.el8.noarch
    dpkg-perl >= 1.17.14 is needed by debhelper-12.7.3-2.el8.noarch
    perl(Dpkg::BuildProfiles) is needed by debhelper-12.7.3-2.el8.noarch
    po-debconf is needed by debhelper-12.7.3-2.el8.noarch

新たな登場人物たちのインストールを試みましたが、これはいよいよダメだなという感じです。

$ sudo dnf install dh-autoreconf dpkg-dev dpkg-perl po-debconf
Last metadata expiration check: 0:15:37 ago on Tue Aug 10 13:02:10 2021.
Error: 
 Problem 1: conflicting requests
  - nothing provides lzma needed by dpkg-dev-1.18.25-12.el8.noarch
 Problem 2: conflicting requests
  - nothing provides perl(Digest::SHA1) needed by dpkg-perl-1.18.25-12.el8.noarch
 Problem 3: package po-debconf-1.0.21-2.el8.noarch requires perl(Mail::Box::Manager), but none of the providers can be installed
  - conflicting requests
  - nothing provides perl(Devel::GlobalDestruction) needed by perl-Mail-Box-3.008-1.el8.noarch
  - nothing provides perl(File::Remove) needed by perl-Mail-Box-3.008-1.el8.noarch
 Problem 4: package dh-autoreconf-19-6.el8.noarch requires debhelper, but none of the providers can be installed
  - package dh-autoreconf-19-6.el8.noarch requires perl(Debian::Debhelper::Dh_Lib), but none of the providers can be installed
  - package debhelper-12.7.3-2.el8.noarch requires perl(Dpkg::BuildProfiles), but none of the providers can be installed
  - package debhelper-12.7.3-2.el8.noarch requires dpkg-perl >= 1.17.14, but none of the providers can be installed
  - conflicting requests
  - nothing provides perl(Digest::SHA1) needed by dpkg-perl-1.18.25-12.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

ここまでの結果から、dnfリポジトリ経由とrpmファイル単体でのインストールは無理そうだとわかりました。
他の方法となると、ソースからコンパイルしてインストールという方法がすぐに浮かびます。
「centos8 alien install」といったキーワードでググると、そういった情報が見つかります。

しかしながら、あまりやりたくはありません。なんとかRPMでインストールしたいなと。

ソースが手に入るなら、ソースからRPMパッケージを作成するという方法が考えられますので、これを試してみようと思います。

alienのページに「Downloading alien」とあるので、ここからソースファイルを取得して、 rpmbuild コマンドを使ってRPMを作成してみました。

$ curl -sL https://sourceforge.net/projects/alien-pkg-convert/files/latest/download -o alien_8.95.tar.xz
$ tar Jxf alien_8.95.tar.xz 
$ mv alien-8.95 alien
$ tar zcf alien_8.95.tar.gz alien
$ rpmbuild -ta alien_8.95.tar.gz
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.EL6aru
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
・
・
+ cd alien
+ /usr/bin/rm -rf /home/vagrant/rpmbuild/BUILDROOT/alien-8.95-1.x86_64
+ exit 0

$ ls -l rpmbuild/RPMS/noarch/alien-8.95-1.noarch.rpm 
-rw-rw-r--. 1 vagrant vagrant 90272 Aug 10 14:09 rpmbuild/RPMS/noarch/alien-8.95-1.noarch.rpm

ソースファイルから作成したRPMファイルをインストールしてみると。。。成功しました!
バージョンとヘルプの表示も問題ないようです。

$ sudo rpm -ivh rpmbuild/RPMS/noarch/alien-8.95-1.noarch.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:alien-8.95-1                     ################################# [100%]

$ alien --version
alien version 8.95

$ alien --help
Usage: alien [options] file [...]
  file [...]                Package file or files to convert.
  -d, --to-deb              Generate a Debian deb package (default).
     Enables these options:
       --patch=<patch>      Specify patch file to use instead of automatically
                            looking for patch in /var/lib/alien.
       --nopatch        Do not use patches.
       --anypatch           Use even old version os patches.
       -s, --single         Like --generate, but do not create .orig
                            directory.
       --fixperms           Munge/fix permissions and owners.
       --test               Test generated packages with lintian.
  -r, --to-rpm              Generate a Red Hat rpm package.
      --to-slp              Generate a Stampede slp package.
  -l, --to-lsb              Generate a LSB package.
  -t, --to-tgz              Generate a Slackware tgz package.
     Enables these options:
       --description=<desc> Specify package description.
       --version=<version>  Specify package version.
  -p, --to-pkg              Generate a Solaris pkg package.
  -i, --install             Install generated package.
  -g, --generate            Generate build tree, but do not build package.
  -c, --scripts             Include scripts in package.
      --target=<arch>       Set architecture of the generated package.
  -v, --verbose             Display each command alien runs.
      --veryverbose         Be verbose, and also display output of run commands.
  -k, --keep-version        Do not change version of generated package.
      --bump=number         Increment package version by this number.
  -h, --help                Display this help message.
  -V, --version         Display alien's version number.


alienを使ってRPMをdebに変換してみる

インストールが成功したのでRPMパッケージをdebパッケージに変換してみたいと思います。
冒頭で依存関係がシンプルなパッケージが変換に向いているということを述べましたが、ちょうどいい感じのパッケージがありますね。
そうです。先ほど作成した alien のRPMパッケージをdebに変換してみましょう。

RPM → deb の場合は -d もしくは --to-deb なので、このオプションを付けて実行してみるとエラーが発生しました。。。

$ sudo alien -d rpmbuild/RPMS/noarch/alien-8.95-1.noarch.rpm 
Package build failed. Here's the log:
dh_testdir
make: dh_testdir: Command not found
make: *** [debian/rules:7: build] Error 127

dh_testdir が見つからないということなんですが、 このコマンドはどうやら debhelper に含まれているようです。。。

はい。ということで、ちょっとこれ以上はやってられないなと感じたので、今回はここまでとします。解散。

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