# העברת פורום SMF2 ל-Discourse

**URL:** https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314
**Category:** Sysadmins
**Tags:** how-to
**Created:** [20 ביוני,‏ 2018,‏ 2:26pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314 "2018-06-20T14:26:51Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [26 בספטמבר,‏ 2019,‏ 1:40pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/21 "2019-09-26T13:40:30Z")

</div>

Maybe open a ticket with Duffield ocean about the characters being wrong?

You might use an ssh client like putty or the new shell that I think is part of Linux subsystem for windows (the last version of windows that I used had a year as it’s version descriptor, so I’m no help). If you use a Mac just open a terminal and use ssh.

If your database is big it will take a while for the database to load and there will be no output except a new prompt when it’s done. My guess is that it was working properly.

---

<div class="post-metadata">

### Author: ![TheEngineer](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@TheEngineer](https://meta.discourse.org/u/TheEngineer)
#### Post date: [26 בספטמבר,‏ 2019,‏ 1:55pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/22 "2019-09-26T13:55:24Z")

</div>

Thanks @pfaffman. I think I will reach out to them about that.

I can try a different ssh client and see if that works better.

The database isn’t that large. It has been sitting for an hour now and still in the same spot. I checked the CPU on the server and it is essentially idling.

---

<div class="post-metadata">

### Author: ![TheEngineer](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@TheEngineer](https://meta.discourse.org/u/TheEngineer)
#### Post date: [26 בספטמבר,‏ 2019,‏ 2:04pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/23 "2019-09-26T14:04:33Z")

</div>

Yep, that was the issue! Thanks again @pfaffman. Making progress again…

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [26 בספטמבר,‏ 2019,‏ 2:07pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/24 "2019-09-26T14:07:17Z")

</div>

Another solution is to allow access to the database directly from the droplet doing the import,thereby skipping the step of having a local database.

If it’s been an hour then it’s likely its not happening. You might try something like

```
 cat database.sql | mysql

```

---

<div class="post-metadata">

### Author: ![TheEngineer](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@TheEngineer](https://meta.discourse.org/u/TheEngineer)
#### Post date: [26 בספטמבר,‏ 2019,‏ 2:52pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/25 "2019-09-26T14:52:17Z")

</div>

One step forward, one step back.

```plaintext
Pups::ExecError: if [-z "$LETSENCRYPT_ACCOUNT_EMAIL"]; then echo "LETSENCRYPT_ACCOUNT_EMAIL ENV variable is required and has not been set."; exit 1; fi failed with return #<Process::Status: pid 1187 exit 1>

```

I did not have letsencrypt installed, so I installed it.

What’s missing from “Preparing the the Discourse Host and container for importing” is that you need to uncomment the env line for LETSENCRYPT\_ACCOUNT\_EMAIL and enter your email address. That got me past this error.

---

<div class="post-metadata">

### Author: ![TheEngineer](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@TheEngineer](https://meta.discourse.org/u/TheEngineer)
#### Post date: [26 בספטמבר,‏ 2019,‏ 4:46pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/26 "2019-09-26T16:46:48Z")

</div>

In a continuation, now I’m at the final import step. I enter the import container and run the import script. It immediately quits with:

```plaintext
Traceback (most recent call last):
        1: from script/import_scripts/smf2.rb:4:in `<main>'
script/import_scripts/smf2.rb:4:in `require': cannot load such file -- mysql2 (LoadError)

```

Lots of web searches, but coming up empty so far.

EDIT: I think this might be that mysql is not installed in the container. I’ve tried ‘gem install mysql2’, but that kicks back

```plaintext
mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.

```

EDIT 2:  
So I managed to get mysql2 installed. First I had to get the dev tools installed, but the suggested source wasn’t available. So I ran

```plaintext
sudo apt-get install default-libmysqlclient-dev

```

From there I was able to

```plaintext
gem install mysql2

```

I still got the same error. So I tried commenting out that require in the script just to see what would happen. Got a new error:

```plaintext
Traceback (most recent call last):
        6: from script/import_scripts/smf2.rb:627:in `<main>'
        5: from script/import_scripts/smf2.rb:19:in `run'
        4: from script/import_scripts/smf2.rb:447:in `parse!'
        3: from script/import_scripts/smf2.rb:502:in `parser'
        2: from script/import_scripts/smf2.rb:502:in `new'
        1: from /usr/local/lib/ruby/2.6.0/optparse.rb:1089:in `initialize'
script/import_scripts/smf2.rb:504:in `block in parser': can't modify frozen String (FrozenError)

```

Researching that comes back with an old Ruby bug, but it was fixed a long while back so I’m stuck again.

---

<div class="post-metadata">

### Author: ![Paracelsus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paracelsus/32/164912_2.png) [@Paracelsus](https://meta.discourse.org/u/Paracelsus)
#### Post date: [1 באוקטובר,‏ 2019,‏ 8:48am UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/27 "2019-10-01T08:48:54Z")

</div>

> [@TheEngineer](#):
>
> Traceback (most recent call last):  
> 6: from script/import\_scripts/smf2.rb:627:in `<main>' 5: from script/import_scripts/smf2.rb:19:in `run’  
> 4: from script/import\_scripts/smf2.rb:447:in `parse!' 3: from script/import_scripts/smf2.rb:502:in `parser’  
> 2: from script/import\_scripts/smf2.rb:502:in `new' 1: from /usr/local/lib/ruby/2.6.0/optparse.rb:1089:in `initialize’  
> script/import\_scripts/smf2.rb:504:in `block in parser’: can’t modify frozen String (FrozenError)
> 
> ```plaintext
> Researching that comes back with an old Ruby bug, but it was fixed a long while back so I'm stuck again.
> 
> ```

Go to smf2.rb and change the Frozen string from true to false or the other way around, it’s on the first or second line. It will work after that.

---

<div class="post-metadata">

### Author: ![TheEngineer](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@TheEngineer](https://meta.discourse.org/u/TheEngineer)
#### Post date: [1 באוקטובר,‏ 2019,‏ 1:39pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/28 "2019-10-01T13:39:32Z")

</div>

Thank you @Paracelsus! That fixed it. I changed it from true to false.

One step closer!

EDIT:  
I had an error that was odd and seemed to be pointing to the wrong IP. It was that I had the wrong password in the Settings.php. That’s fixed.

Now figuring out:

```plaintext
Traceback (most recent call last):
        7: from script/import_scripts/smf2.rb:627:in `<main>'
        6: from script/import_scripts/smf2.rb:28:in `run'
        5: from script/import_scripts/smf2.rb:28:in `new'
        4: from script/import_scripts/smf2.rb:62:in `initialize'
        3: from script/import_scripts/smf2.rb:274:in `create_db_connection'
        2: from script/import_scripts/smf2.rb:274: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': Plugin caching_sha2_password could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory (Mysql2::Error::ConnectionError)

```

I’m assuming this line in the script tuning file is to address this:

```plaintext
ALTER USER 'user'@'%' IDENTIFIED WITH mysql_native_password BY 'pass';

```

Should that be added somewhere inside the import container?

---

<div class="post-metadata">

### Author: ![TheEngineer](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@TheEngineer](https://meta.discourse.org/u/TheEngineer)
#### Post date: [4 באוקטובר,‏ 2019,‏ 12:47pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/29 "2019-10-04T12:47:55Z")

</div>

Alright, I figured out the above issue. This is a problem with the latest version of MySQL. It doesn’t support the older native passwords anymore. The easiest way to tackle this is to run this process using MySQL 5.7. Just change step 3 from:

```plaintext
docker run -d -e MYSQL_ROOT_PASSWORD=pass -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -v ~/smf2:/backup --name=mysql mysql

```

to

```plaintext
docker run -d -e MYSQL_ROOT_PASSWORD=pass -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -v ~/smf2:/backup --name=mysql mysql:5.7

```

and you should be golden. My import is finally running.

---

<div class="post-metadata">

### Author: ![Paracelsus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paracelsus/32/164912_2.png) [@Paracelsus](https://meta.discourse.org/u/Paracelsus)
#### Post date: [6 באוקטובר,‏ 2019,‏ 8:58am UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/30 "2019-10-06T08:58:23Z")

</div>

A new question: I can’t seem to get the user avatars imported. Is it supposed to be like this?

I have the ones that need redimension being saved on a custom folder instead of the standard one in SMF, could this be the reason?

Otherwise, so far so good. This guide is great and the incremental database imports work great too 👍.

---

<div class="post-metadata">

### Author: ![TheEngineer](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@TheEngineer](https://meta.discourse.org/u/TheEngineer)
#### Post date: [7 באוקטובר,‏ 2019,‏ 2:10pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/31 "2019-10-07T14:10:51Z")

</div>

Ours came over without any extra steps. I’m not sure where SMF stores avatars off-hand. Have you brought over your attachments? I only imported our SQL DB and attachments, so my guess is they are in there.

---

<div class="post-metadata">

### Author: ![Paracelsus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paracelsus/32/164912_2.png) [@Paracelsus](https://meta.discourse.org/u/Paracelsus)
#### Post date: [20 באוקטובר,‏ 2019,‏ 7:43pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/32 "2019-10-20T19:43:49Z")

</div>

Yes, they were there, but I had the avatars moved to another folder and forgot to copy it to the avatar folder that the import uses to match with the user. Problem solved (even if I had to remake the import).

A new issue now… banned users don’t appear as suspended when imported, just as inactivated. Any ideas on how to get them suspended instead?

---

<div class="post-metadata">

### Author: ![tradenet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tradenet/32/172185_2.png) [@tradenet](https://meta.discourse.org/u/tradenet)
#### Post date: [11 במרץ,‏ 2020,‏ 11:39am UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/33 "2020-03-11T11:39:25Z")

</div>

I am using v2.50 beta2 latest version of SMF v2.0.17 and there is a different smf2.rb generated because of the current:  
templates/import/mysql-dep.template.yml  
As explained in Step 4. replacing “quote =” the current iteration is:

> quote = +“\n[quote="#{params[‘author’]}”

And further there is no:

> [@marcozambi](#):
>
> quote \<\< “"]#{convert\_quotes(inner)}[/quote]”

However, I went ahead and performed the import unfortunately it dies with “IGNORE\_BBCODE do you mean IgnoreUser.”  
Sorry, I should of taken a screenshot of the Traceback but didn’t, anyway that’s my recollection.  
Any ideas?  
Thx.

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [11 במרץ,‏ 2020,‏ 12:22pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/34 "2020-03-11T12:22:11Z")

</div>

I recently updated this script. I’ll have a look.

---

<div class="post-metadata">

### Author: ![tradenet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tradenet/32/172185_2.png) [@tradenet](https://meta.discourse.org/u/tradenet)
#### Post date: [11 במרץ,‏ 2020,‏ 12:48pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/36 "2020-03-11T12:48:44Z")

</div>

Thank-you very much! Question if I start over again will it overwrite what I imported already? ie. users, categories.  
Cheers!  
G.

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [11 במרץ,‏ 2020,‏ 12:55pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/37 "2020-03-11T12:55:13Z")

</div>

Generally no. The import scripts are smart enough to stay where you left off!

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [11 במרץ,‏ 2020,‏ 3:20pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/38 "2020-03-11T15:20:52Z")

</div>

@tradenet should be fixed now here:

[https://github.com/discourse/discourse/commit/6c948f27ea607018265d1097e3f5a63f66d62c0c](https://github.com/discourse/discourse/commit/6c948f27ea607018265d1097e3f5a63f66d62c0c)

Sorry about that!

Will be available in `tests-passed` as soon as all the checks complete.

---

<div class="post-metadata">

### Author: ![tradenet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tradenet/32/172185_2.png) [@tradenet](https://meta.discourse.org/u/tradenet)
#### Post date: [11 במרץ,‏ 2020,‏ 3:33pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/39 "2020-03-11T15:33:42Z")

</div>

Thank-you for your kind attention.  
G.

---

<div class="post-metadata">

### Author: ![Zup](https://avatars.discourse-cdn.com/v4/letter/z/c37758/32.png) [@Zup](https://meta.discourse.org/u/Zup)
#### Post date: [17 ביולי,‏ 2020,‏ 10:56pm UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/40 "2020-07-17T22:56:21Z")

</div>

will old SMF urls be broken after converting to Discourse?

---

<div class="post-metadata">

### Author: ![marcozambi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marcozambi/32/119505_2.png) [@marcozambi](https://meta.discourse.org/u/marcozambi)
#### Post date: [18 ביולי,‏ 2020,‏ 8:56am UTC](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314/41 "2020-07-18T08:56:56Z")

</div>

Not really. The importer will create permalinks that match (and redirect) the old URLs to their new paths.

[Previous page](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314.md?page=1)

[Next page](https://meta.discourse.org/t/migrate-an-smf2-forum-to-discourse/90314.md?page=3)
