pacmanでconflictが起きまくった時のメモ

インストールしたてのArch Linuxはかなりconflictが起きる。メモをしておくと誰かに役に立つと思う。

Arch LinuxのISOのバージョンは arch-linux-2011.08.19 の日付のやつだった。

※注
$ から始まるコマンドはユーザ権限、普通に実行できるコマンド、
# から始まるコマンドはルート権限、sudoや、rootに切り替えないと実行できないコマンドになる。

起こったconflict

conflict 1

最初は

# pacman -Syu

をしたときにconflictが起こる。

error: failed to commit transaction (conflicting files)
filesystem: /etc/mtab exists in filesystem
Errors occurred, no packages were upgraded.

どういうことなの...。

調べるとなんだかfilesystemを強制アップデートしないといけないらしい。
@see [Solved] Pacman "filesystem: /etc/mtab exists in filesystem" / Newbie Corner / Arch Linux Forums
filesystems: @see Arch Linux - News: filesystem upgrade - manual intervention required

# pacman -S filesystem --force

--forceオプションは危険なオプションなので普段使わない方がいいけれど、今回は使わないといけない。

conflict 2

2つ目のconflictはgnomeをインストールしようとした時に起きた。

# pacman -S gnome

ここで

 error: failed to commit transaction (conflicting files)
 libltdl: /usr/include/libltdl/lt_dlloader.h exists in filesystem
 libltdl: /usr/include/libltdl/lt_error.h exists in filesystem
 libltdl: /usr/include/libltdl/lt_system.h exists in filesystem
 libltdl: /usr/include/ltdl.h exists in filesystem
 libltdl: /usr/lib/libltdl.a exists in filesystem
 libltdl: /usr/lib/libltdl.so exists in filesystem
 libltdl: /usr/lib/libltdl.so.7 exists in filesystem
 libltdl: /usr/lib/libltdl.so.7.3.0 exists in filesystem
...
...

とよくわからないconflictが起こるorz。
下のリンクを見ると # pacman -Qo /usr/include/lt_dlloader.h というコマンドをやるとエラーの原因のパッケージがわかるとのこと。
@see [SOLVED] fvwm-crystal doesn't install. Help / Applications & Desktop Environments / Arch Linux Forums

実際コマンドを打ってみると、

# pacman -Qo /usr/include/libltdl/lt_dlloader.h
->/usr/include/libltdl/lt_dlloader.h is owned by libltdl 2.4.2-2

と出る。このconflictの元になってるパッケージを先にインストールするといいみたい。

# pacman -S libtools

自分はこれでgnomeのconflictを解決してたと思う。また他のconflictが起こっても同じように # pacman -Qo とすれば原因となってるパッケージがわかってちゃんと解決できるはず。

conflict 3

上のやつと更にもう一つconflictが起きてた。

# pacman -Syu

の時だったか...

error: failed to commit transaction (conflicting files)
initscripts: /etc/profile.d/locale.sh exists in filesystem
Errors occurred, no packages were upgraded.

これは下のリンクのエラー文の一部だけど、だいたいこんなエラー文だった。
@see Recent Syu(read the news..solved) / Kernel & Hardware / Arch Linux Forums

# pacman -Qo /etc/profile.d/locale.sh
-> /etc/profile.d/locale.sh is owned by initscripts

と出るので

# pacman -S initscripts --force

とやれば解決できるかもしれない。自分はちょっと違う方法で解決した。

$ cd /etc/profile.d/
# mv locale.sh locale.sh.bak

で名前変える方法で解決した(でも手動変更はpacmanの方針に合わない)

ここにconflictが起きた時どう対処したほうがいいか書いてた。
@see pacman error: FILENAME exists in filesystem / Newbie Corner / Arch Linux Forums

conflict解決のコツ

# pacman -Syu などのアップデート時のconflictエラーは # pacman -Qo とすれば依存パッケージがわかってそれを先にインストールすれば解決することが多いみたい。特殊な事例の場合は--forceとすれば解決する。

ちょっと一言

Arch LinuxはAURというかなり便利なユーザーリポジトリがあってOperaの一発インストールができた。他にも便利なパッケージがありそうで探し甲斐がありそう。

追記 2012.4.20
実はこれはnet-installerバージョンなら起こらないことなので、普通のネット環境がありつつCD版を使っている人は素直にnet-installerバージョンを使いましょう。

追記 2012.4.7

locale.shのconflict解消方法に、--force オプションを入れるのを忘れていたので修正。

追記 2012.6.15

インストール時のCDのバージョン情報を追加。

追記 2013.5.12

#と$の説明を追加。あと少し修正。