# PHPBB3 Import failling at first stage

**URL:** <https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556>\
**Category:** Self-hosting\
**Created:** [September 26, 2019, 11:23am 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

## AI-generated summary

**PHPBB3 Import Failing at First Stage**

The user [robtech](/t/-/129556/1) is experiencing issues with importing data from PHPBB3 into Discourse. The import process fails early on due to a problem creating a directory. After investigating, [robtech](/t/-/129556/2) discovers that the issue is related to an outdated key and a mismatch between Ubuntu and Debian repositories.

[gerhard](/t/-/129556/3) suggests a fix by applying changes to the template, which involves switching from Ubuntu to Debian repositories. [robtech](/t/-/129556/4) confirms that the fix works, but encounters further issues when running `import_phpbb3.sh` inside the import container.

After restarting the MySQL server using `/etc/init.d/mysql stop` and `/etc/init.d/mysql start`, [robtech](/t/-/129556/5) is able to run `import_phpbb3.sh`, but encounters an "Access denied" error. [gerhard](/t/-/129556/7) provides an updated fix, which involves pulling the latest changes and rebuilding the import container.

However, [robtech](/t/-/129556/8) still encounters an "Unknown database" error. [gerhard](/t/-/129556/9) provides further guidance, suggesting that the issue is related to the database dump file and the "imported" directory. Deleting the "imported" directory resolves the issue, and the import process begins successfully.

Ultimately, [robtech](/t/-/129556/11) reports that the import process completes successfully, and they are grateful for [gerhard](/t/-/129556/7)'s assistance in resolving the issue.

<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:** [September 26, 2019, 11:23am UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/1 "2019-09-26T11:23:23Z")

</div>

I’ve set up a brand new Discourse, I’ve activated it and it works fine. No changes have been applied at all. I’m trying to perform a PHPBB3 import, but it’s failing very early on, before the sql dump has even been called upon. Seems there is a problem creating a directory, but can’t understand why or how to fix.

First I run these:

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

```

Then I update the import.yml to add the entry to the list of templates.

Then I run this:

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

```

But it fails to bootstrap and gives me this in failed:

```
FAILED

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

Pups::ExecError: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y nano libmariadbclient-dev mariadb-server failed with return #<Process::Status: pid 751 exit 100>

Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'

exec failed with the params {"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

**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one.

./discourse-doctor may help diagnose the problem.

```

Pulling my hair out trying to fix this. Please can anyone suggest where I’m going wrong?

---

<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:** [September 26, 2019, 4:01pm UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/2 "2019-09-26T16:01:07Z")

</div>

Digging into this a bit deeper has led me to this post which seems to be the same error I’m having.

> [@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!

I noticed that the fix was to update the repos with the latest Ubuntu version. I’ve changed this section in 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

```

to:

```
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

```

But it looks like this is still failing because the key used is now out of date. Can anyone help me with the key so I can test this theory?

---

<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:** [September 26, 2019, 4:24pm UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/3 "2019-09-26T16:24:00Z")

</div>

We switched from Ubuntu to Debian. That’s why it isn’t working anymore.  
I gave it a quick try and it mostly works by applying the following changes, but somehow the MariaDB server didn’t automatically start. I’ll have a look when I have more time…

You could manually apply those changes to the template for now and start the server by running `service mysql stop` and `service mysql start` inside the container afterwards. That _should_ work.

[https://github.com/discourse/discourse\_docker/pull/449](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:** [September 26, 2019, 4:43pm UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/4 "2019-09-26T16:43:43Z")

</div>

That fix seems to be working. I’ll continue with the import and see how it goes. Thanks a lot.

---

<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:** [September 26, 2019, 8:59pm UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/5 "2019-09-26T20:59:27Z")

</div>

I’m having trouble running import\_phpbb3.sh inside the import container. I had to restart the mysql by using the commands

`/etc/init.d/mysql stop`

and

`/etc/init.d/mysql start`

then I could enter the import container, where I ran import\_phpbb3.sh, but it failed:

```
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** **)**

```

Can you suggest how to proceed?

---

<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:** [October 1, 2019, 12:21am UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/7 "2019-10-01T00:21:50Z")

</div>

Can you give it another try? It should work again.

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

```

[https://github.com/discourse/discourse\_docker/commit/3df237a641d4b0bdcf5068eb9a21420da1646da3](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:** [October 1, 2019, 8:54pm UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/8 "2019-10-01T20:54:26Z")

</div>

Thanks, I’ve tried it but I’m still getting an error I’m afraid:

```
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': **Unknown database '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:** [October 1, 2019, 11:21pm UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/9 "2019-10-01T23:21:13Z")

</div>

Please make sure that `/var/discourse/shared/standalone/import/data/phpbb_mysql.sql` exists and is a valid database dump. Then delete `/var/discourse/shared/standalone/import/mysql/imported` and try again.

---

<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:** [October 1, 2019, 11:53pm UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/10 "2019-10-01T23:53:12Z")

</div>

Deleting `/var/discourse/shared/standalone/import/mysql/imported` worked and the import has begun! I’ll report back my results when the import has completed.

---

<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:** [October 2, 2019, 11:29am UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/11 "2019-10-02T11:29:12Z")

</div>

Everything seems to have worked. I’m running through the Sidekiq processes now.

Really grateful for your efforts on this @gerhard, you’ve put an end to a lot of stress for me. Thanks a lot.

---

<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:** [November 1, 2019, 11:38am UTC](https://meta.discourse.org/t/phpbb3-import-failling-at-first-stage/129556/12 "2019-11-01T11:38:57Z")

</div>

Closed on November 1, 2019, 11:38am UTC

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