# Old image uploads become broken images

**URL:** https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236
**Category:** Support
**Created:** [July 13, 2016, 6:38pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236 "2016-07-13T18:38:57Z")
**Posts on this page:** 20
**Page:** 3

<div class="post-metadata">

### Author: ![brahn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brahn/32/109267_2.png) [@brahn](https://meta.discourse.org/u/brahn)
#### Post date: [March 9, 2019, 1:10pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/41 "2019-03-09T13:10:47Z")

</div>

> [@michaeld](#):
>
> disabling Sidekiq

How is this magic done? I just discovered a whole bunch of linked images tombstoned when a user pointed out their old post had 404s.  
Running `rake uploads:recover_from_tombstone` now, 22/1281!

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [March 9, 2019, 8:09pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/42 "2019-03-09T20:09:38Z")

</div>

From a Rails console you can do

`Sidekiq.pause!`

and

`Sidekiq.unpause!`

---

<div class="post-metadata">

### Author: ![brahn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brahn/32/109267_2.png) [@brahn](https://meta.discourse.org/u/brahn)
#### Post date: [March 10, 2019, 3:39am UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/43 "2019-03-10T03:39:13Z")

</div>

Thanks! However, I guess my issue is different as I never upgrade the site from the web UI but only via `./launcher rebuild app` and somehow I was hit with this issue too. The `recover_from_tombstone` seems to have done the trick though.

---

<div class="post-metadata">

### Author: ![Ark74](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ark74/32/118027_2.png) [@Ark74](https://meta.discourse.org/u/Ark74)
#### Post date: [August 19, 2020, 8:29pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/44 "2020-08-19T20:29:35Z")

</div>

I have restored from one server to another, using the same domain, and same version on both.

The issue I have is that all the images are on the backup (tar.gz) file but when restored to the new server, well.  
All images are broken, notoriously category images, site logo, user profile images, etc.

I’ve tried to solve it using,

- rebuild app
- rake posts:rebake
- rake posts:missing\_uploads
- rake uploads:recover\_from\_tombstone

But if I try to check an image, I still get a 404 error, any idea?

---

<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: [August 19, 2020, 8:36pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/45 "2020-08-19T20:36:59Z")

</div>

How did you install the new server?

---

<div class="post-metadata">

### Author: ![Ark74](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ark74/32/118027_2.png) [@Ark74](https://meta.discourse.org/u/Ark74)
#### Post date: [August 19, 2020, 8:44pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/46 "2020-08-19T20:44:08Z")

</div>

Hi, thanks for checking this out,  
The procedure was like,

1. update old server to latest (via gui)
2. clone the repo /var/discourse (new server)
3. copy app.yml from old server to new server
4. ./launcher rebuild app (new server)
5. download backup.tar.gz file (old server)
6. restore backup on new server

Basically that was it.

---

<div class="post-metadata">

### Author: ![Ark74](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ark74/32/118027_2.png) [@Ark74](https://meta.discourse.org/u/Ark74)
#### Post date: [August 20, 2020, 10:36pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/47 "2020-08-20T22:36:06Z")

</div>

And still got broken images 😭

Any idea of what can be done?  
The files are on the backup, but they wont be used.

Any idea?

---

<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: [August 21, 2020, 12:34am UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/48 "2020-08-21T00:34:38Z")

</div>

No idea. Was there a CDN at some point?

Maybe do a `rake posts:rebake`?

---

<div class="post-metadata">

### Author: ![Ark74](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ark74/32/118027_2.png) [@Ark74](https://meta.discourse.org/u/Ark74)
#### Post date: [August 21, 2020, 1:42am UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/49 "2020-08-21T01:42:08Z")

</div>

No CDN

> [@Ark74](#):
>
> I’ve tried to solve it using,
> 
> - rebuild app
> - rake posts:rebake
> - rake posts:missing\_uploads
> - rake uploads:recover\_from\_tombstone

As mentioned here already done that.  
No luck

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [August 21, 2020, 5:46am UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/50 "2020-08-21T05:46:39Z")

</div>

Have you confirmed that the image files are actually in the expected locations on your file system? Also, can you share the URL of your site? That might show us something.

---

<div class="post-metadata">

### Author: ![Ark74](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ark74/32/118027_2.png) [@Ark74](https://meta.discourse.org/u/Ark74)
#### Post date: [August 21, 2020, 1:04pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/51 "2020-08-21T13:04:29Z")

</div>

Hello Bart,

Well, not really.  
In not really sure where they should be, I opened the backup file and the where there, so I’m guessing they are, where is there a path I should check to confirm?

The site is:  
[discourse.switnet.net](http://discourse.switnet.net)

Regards

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [August 21, 2020, 1:18pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/52 "2020-08-21T13:18:18Z")

</div>

Check

```plaintext
/var/discourse/shared/standalone/uploads/default/original

```

So for a file like this one (which is broken):

```plaintext
https://discourse.switnet.net/uploads/default/original/1X/d8861c0b6d1855c36178866ec4c19f8db44db589.png

```

The original should be in

```plaintext
/var/discourse/shared/standalone/uploads/default/original/1X/d8861c0b6d1855c36178866ec4c19f8db44db589.png

```

If they’re missing, you can just extract the uploads/default/original folder from your backup and move them there (keep the directory structure intact).

---

<div class="post-metadata">

### Author: ![Ark74](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ark74/32/118027_2.png) [@Ark74](https://meta.discourse.org/u/Ark74)
#### Post date: [August 21, 2020, 1:33pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/53 "2020-08-21T13:33:57Z")

</div>

Yay!  
That was the reason, thank you very much!! 😉

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [August 21, 2020, 1:40pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/54 "2020-08-21T13:40:10Z")

</div>

Nice! I’m glad that helped 🙂

---

<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: [August 21, 2020, 1:41pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/55 "2020-08-21T13:41:54Z")

</div>

Looks like you just fixed it yourself! That’s good to know.

For anyone else reading this: There was a bug which was introduced shortly after v2.6.0.beta1. I fixed it in [FIX: Backups should use relative paths for local uploads · discourse/discourse@f51ccea · GitHub](https://github.com/discourse/discourse/commit/f51ccea02816c768863b1073977db219f4b66ff3) and backported it to the beta branch.

From now on backups will be created correctly again and restoring a backup that was created in the time between v2.6.0.beta1 and the bugfix will work as well.

---

<div class="post-metadata">

### Author: ![Ark74](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ark74/32/118027_2.png) [@Ark74](https://meta.discourse.org/u/Ark74)
#### Post date: [August 21, 2020, 1:58pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/56 "2020-08-21T13:58:51Z")

</div>

Thanks for letting me know, and even more the fix.  
Odds we not on my favor this time, thankfully is back to normal.

Regards

---

<div class="post-metadata">

### Author: ![marianord](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marianord/32/90502_2.png) [@marianord](https://meta.discourse.org/u/marianord)
#### Post date: [August 22, 2020, 3:34am UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/57 "2020-08-22T03:34:14Z")

</div>

This might explain a lot of why I wasn’t able to spin up a totally new test instance last week. Awesome to know, thanks @gerhard and all the team for always improving and answering.

> Sorry for the slight off-topic.

---

<div class="post-metadata">

### Author: ![Jeremie\_Leroy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jeremie_leroy/32/84427_2.png) [@Jeremie\_Leroy](https://meta.discourse.org/u/Jeremie_Leroy)
#### Post date: [May 9, 2021, 11:16am UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/58 "2021-05-09T11:16:58Z")

</div>

Hi All,

Images are broken on our forum, I updated all the plugins and Discourse, I rebuilt the app, but it’s still not fixing it ;( .

Here is an example → [https://francais-a-londres.org/t/nous-recherchons-de-toute-urgence-runners-et-commis-waiters/23050](https://francais-a-londres.org/t/nous-recherchons-de-toute-urgence-runners-et-commis-waiters/23050)

Is the problem related to s3?

Many thanks,

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [May 9, 2021, 5:56pm UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/59 "2021-05-09T17:56:05Z")

</div>

You migrated recently? Seems like it’s only the previews (in the optimized folder) that are broken

A rake posts rebake should fix it, I had the same issue after a migration, I forgot about the backup setting that add the optimized files

---

<div class="post-metadata">

### Author: ![Jeremie\_Leroy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jeremie_leroy/32/84427_2.png) [@Jeremie\_Leroy](https://meta.discourse.org/u/Jeremie_Leroy)
#### Post date: [May 12, 2021, 7:57am UTC](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/60 "2021-05-12T07:57:21Z")

</div>

thanks @Steven for your answer, i didn’t migrate. On your advise i did a post rebake, but i’m still facing the same problem, here another exemple with another post → [https://francais-a-londres.org/t/le-systeme-educatif-au-royaume-uni/23102](https://francais-a-londres.org/t/le-systeme-educatif-au-royaume-uni/23102)

It seems related to categories because in our accommodation category it seems to be working…

[Previous page](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236.md?page=2)

[Next page](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236.md?page=4)
