# PHPBB3 のインポートが最初の段階で失敗

**URL:** https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556
**Category:** Self-hosting
**Created:** [2019 年 9 月 26 日午前 11:23 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556 "2019-09-26T11:23:23Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![robtech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robtech/32/161256_2.png) [@robtech](https://meta.discourse.org/u/robtech)
#### Post date: [2019 年 9 月 26 日午前 11:23 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/1 "2019-09-26T11:23:23Z")

</div>

Discourse を新規にセットアップし、有効化しましたが、問題なく動作しています。変更は全く加えていません。PHPBB3 のインポートを実行しようとしたところ、SQL ダンプが呼び出される以前に非常に早期に失敗しています。ディレクトリの作成に問題があるようですが、その理由や修正方法がわかりません。

まず、以下のコマンドを実行します。

```
cd /var/discourse
cp containers/app.yml containers/import.yml
nano containers/import.yml

```

次に、import.yml を編集してテンプレート一覧にエントリを追加します。

その後、以下のコマンドを実行します。

```
/var/discourse/launcher stop app
/var/discourse/launcher rebuild import

```

しかし、ブートストラップに失敗し、failed に以下が表示されます。

```
FAILED

--------------------

Pups::ExecError: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y nano libmariadbclient-dev mariadb-server がエラーで終了しました。戻り値: #<Process::Status: pid 751 exit 100>

失敗場所: /pups/lib/pups/exec_command.rb:112:in `spawn'

exec が以下のパラメータで失敗しました: {"cmd"=>["mkdir -p /shared/import/mysql/data", "apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8", "add-apt-repository 'deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu xenial main'", "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y nano libmariadbclient-dev mariadb-server", "sed -Ei 's/^log/#\&/' /etc/mysql/my.cnf"]}

35bdae869b75c936048af19f082aa5eded27d1ec77b9c53c48216d794775142d

**ブートストラップに失敗しました** 上記にスクロールして、以前のエラーメッセージを確認してください。複数のエラーが含まれている可能性があります。

./discourse-doctor を実行すると問題の診断に役立つかもしれません。

```

この問題を修正しようと必死です。どこが間違っているか、どなたかご助言いただけますでしょうか？

---

<div class="post-metadata">

### Author: ![robtech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robtech/32/161256_2.png) [@robtech](https://meta.discourse.org/u/robtech)
#### Post date: [2019 年 9 月 26 日午後 4:01 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/2 "2019-09-26T16:01:07Z")

</div>

これを少し深く掘り下げると、私が直面しているのと同じエラーが記載されているこの投稿に行き着きました。

> [@Unable to correct problems, you have held broken packages when trying to run a phpBB importer](https://meta.discourse.org/t/unable-to-correct-problems-you-have-held-broken-packages-when-trying-to-run-a-phpbb-importer/46499):
>
> Hello! I’m trying to run a docker phpbb3 importer by following this guide: [Importing from phpBB3](https://meta.discourse.org/t/importing-from-phpbb3/30810) However, during point 3 (./launcher rebuild import), script gives me a following output: [https://gist.github.com/mbajur/529b6358fecaa51bef63ddc1664c5495](https://gist.github.com/mbajur/529b6358fecaa51bef63ddc1664c5495) I was able to run discourse app.yml without any troubles, just the import.yml makes troubles. I’m on Ubuntu 14.04 (digitalocean). Thanks in advance for any clues!

修正方法は、リポジトリを最新の Ubuntu バージョンに更新することだったと気づきました。phpbb3.template.yml のこのセクションを変更しました。

```
cmd:
          - mkdir -p /shared/import/mysql/data
          - apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
          - add-apt-repository 'deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu xenial main'
          - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y nano libmariadbclient-dev mariadb-server
          - sed -Ei 's/^log/#&/' /etc/mysql/my.cnf

```

を以下に変更しました：

```
cmd:
          - mkdir -p /shared/import/mysql/data
          - apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
          - add-apt-repository 'deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu bionic main'
          - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y nano libmariadbclient-dev mariadb-server
          - sed -Ei 's/^log/#&/' /etc/mysql/my.cnf

```

しかし、使用されているキーが現在古くなっているため、まだ失敗しているようです。この仮説を検証するために、キーの更新についてお手伝いいただけませんか？

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [2019 年 9 月 26 日午後 4:24 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/3 "2019-09-26T16:24:00Z")

</div>

Ubuntu から Debian に切り替えたため、もう動作しなくなっています。  
少し試してみたところ、以下の変更を適用すれば大体動作するようですが、どうやら MariaDB サーバーが自動的に起動しませんでした。時間ができたら確認します…

当面は、テンプレートに手動でこれらの変更を適用し、その後コンテナ内で `service mysql stop` と `service mysql start` を実行してサーバーを起動してみてください。これで動くはずです。

> <https://github.com/discourse/discourse_docker/pull/449>

---

<div class="post-metadata">

### Author: ![robtech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robtech/32/161256_2.png) [@robtech](https://meta.discourse.org/u/robtech)
#### Post date: [2019 年 9 月 26 日午後 4:43 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/4 "2019-09-26T16:43:43Z")

</div>

その修正はうまくいっているようです。インポートを続けて、進み具合を確認します。どうもありがとうございます。

---

<div class="post-metadata">

### Author: ![robtech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robtech/32/161256_2.png) [@robtech](https://meta.discourse.org/u/robtech)
#### Post date: [2019 年 9 月 26 日午後 8:59 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/5 "2019-09-26T20:59:27Z")

</div>

import コンテナ内で import\_phpbb3.sh を実行する際に問題が発生しています。以下のコマンドを使用して MySQL を再起動する必要がありました。

`/etc/init.d/mysql stop`

および

`/etc/init.d/mysql start`

その後、import コンテナに入ることができ、そこで import\_phpbb3.sh を実行しましたが、失敗しました。

```
root@mydiscourse-import:/var/www/discourse# import_phpbb3.sh

The phpBB3 import is starting...

**Traceback** (most recent call last):

9: from script/import_scripts/phpbb3.rb:13:in `<main>'

8: from script/import_scripts/phpbb3.rb:14:in `<module:ImportScripts>'

7: from script/import_scripts/phpbb3.rb:26:in `<module:PhpBB3>'

6: from /var/www/discourse/script/import_scripts/phpbb3/database/database.rb:9:in `create'

5: from /var/www/discourse/script/import_scripts/phpbb3/database/database.rb:9:in `new'

4: from /var/www/discourse/script/import_scripts/phpbb3/database/database.rb:15:in `initialize'

3: from /var/www/discourse/script/import_scripts/phpbb3/database/database.rb:39:in `create_database_client'

2: from /var/www/discourse/script/import_scripts/phpbb3/database/database.rb:39:in `new'

1: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:90:in `initialize'

/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:90:in `connect': **Access denied for user 'root'@'localhost' (**  **Mysql2::Error** **)**

```

次にどのように進めるべきかご教示いただけますか？

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [2019 年 10 月 1 日午前 12:21 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/7 "2019-10-01T00:21:50Z")

</div>

もう一度お試しください。正常に動作するはずです。

```plaintext
cd /var/discourse
git pull
./launcher rebuild import

```

> <https://github.com/discourse/discourse_docker/commit/3df237a641d4b0bdcf5068eb9a21420da1646da3>

---

<div class="post-metadata">

### Author: ![robtech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robtech/32/161256_2.png) [@robtech](https://meta.discourse.org/u/robtech)
#### Post date: [2019 年 10 月 1 日午後 8:54 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/8 "2019-10-01T20:54:26Z")

</div>

ありがとうございます。試してみましたが、残念ながらまだエラーが発生しています：

```
phpBB3 のインポートを開始しています...
**バックトレース** （最も最近のものから順）:
9: from script/import_scripts/phpbb3.rb:13:in `<main>'
8: from script/import_scripts/phpbb3.rb:14:in `<module:ImportScripts>'
7: from script/import_scripts/phpbb3.rb:26:in `<module:PhpBB3>'
6: from /var/www/discourse/script/import_scripts/phpbb3/database/database.rb:9:in `create'
5: from /var/www/discourse/script/import_scripts/phpbb3/database/database.rb:9:in `new'
4: from /var/www/discourse/script/import_scripts/phpbb3/database/database.rb:15:in `initialize'
3: from /var/www/discourse/script/import_scripts/phpbb3/database/database.rb:39:in `create_database_client'
2: from /var/www/discourse/script/import_scripts/phpbb3/database/database.rb:39:in `new'
1: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:90:in `initialize'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:90:in `connect': **データベース 'phpbb' が存在しません (**  **Mysql2::Error** **)**

```

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [2019 年 10 月 1 日午後 11:21 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/9 "2019-10-01T23:21:13Z")

</div>

/var/discourse/shared/standalone/import/data/phpbb\_mysql.sql が存在し、有効なデータベースダンプであることを確認してください。その後、/var/discourse/shared/standalone/import/mysql/imported を削除して、再度お試しください。

---

<div class="post-metadata">

### Author: ![robtech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robtech/32/161256_2.png) [@robtech](https://meta.discourse.org/u/robtech)
#### Post date: [2019 年 10 月 1 日午後 11:53 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/10 "2019-10-01T23:53:12Z")

</div>

`/var/discourse/shared/standalone/import/mysql/imported` の削除が成功し、インポートが開始されました！インポート完了後に結果を報告します。

---

<div class="post-metadata">

### Author: ![robtech](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robtech/32/161256_2.png) [@robtech](https://meta.discourse.org/u/robtech)
#### Post date: [2019 年 10 月 2 日午前 11:29 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/11 "2019-10-02T11:29:12Z")

</div>

すべてうまくいったようです。現在、Sidekiq プロセスを実行しています。

gerhard さん、この件での尽力に心から感謝しています。私のストレスの多くが解消されました。本当にありがとうございます。

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2019 年 11 月 1 日午前 11:38 UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/12 "2019-11-01T11:38:57Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
